Hi Angelammarten and welcome to ExcelForum. Thank you for following the rules by using CODE TAGS. It is much appreciated.
Your first construction is perfectly valid and works on my computer:
Sub ShowOrHideActiveXControls()
Dim objOLE As OLEObject
For Each objOLE In ActiveSheet.OLEObjects
If objOLE.progID = "Forms.Checkbox.1" Then
Debug.Print objOLE.Name
objOLE.Visible = True
' objOLE.Visible = False
End If
Next objOLE
End Sub
Your second construction for an 'Active X' Checkbox event handler is incorrect. You will need code similar to the following (tested and working):
Sub Checkbox12_Click()
ActiveSheet.OLEObjects("Checkbox12").Visible = True
End Sub
--------------------
The file associated with post #2 in the following thread may be helpful to you either now or in the future. It creates 'Active X' CheckBoxes and uses one (Class) Event Handler to service all 'Active X' CheckBox change events. http://www.excelforum.com/excel-prog...sition-it.html
-------------------
From your second code sample, you may want to view post #2 on the following thread, which discusses the differences between 'Forms' and 'Active X' controls. http://www.excelforum.com/excel-prog...ml#post3880991
Lewis
Bookmarks