Tech Support Guy banner
Status
Not open for further replies.

Deleting the Check mark only inside the check box using VBA in Excel

3K views 4 replies 3 participants last post by  Zack Barresse 
#1 ·
Hi all

I have been trying to create an Excel macro that deletes only the check mark inside the check box albeit with no success. Is there a way to do this?? I have plenty of check boxes and it is taking me a lot of time to go into each one and delete only the check marks. It would be would be pretty neat to create a macro to delete the check marks in every single check box. If someone out there has figured out how to do it, it would be a great help.

Thanks

Mario
 
#3 ·
Not to worry -- this code from Dave Peterson will do either.

Sub ClearCBs()

Dim CBX As CheckBox
Dim OLEObj As OLEObject

For Each CBX In ActiveSheet.CheckBoxes
CBX.Value = xlOff
Next CBX

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
End If
Next OLEObj
End Sub
 
#5 ·
A control like that will be an object under your sheet object. You should be able to access from there. In your code, refer to it as you would a range object secondary to your worksheet. To find the code name of the checkbox, in design mode, right click it and select properties, it should be listed in there. Let us know if you need more of a hand Mario.
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top