View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Uncheck every Check Box Q

That looks better <vbg.

Here's another way:

Option Explicit
Sub Uncheckboxes2()
Dim wks As Worksheet
Dim OLEObj As OLEObject

Set wks = Worksheets("Input")

For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
End If
Next OLEObj
End Sub

Sean wrote:

Your totally correct Dave, I copied the wrong code to the NG, this is
what I should have shown Doh!

Sub UncheckBoxes()
Application.ScreenUpdating = False

Sheets("Input").Activate
For Each ctrl In ActiveSheet.OLEObjects
If UCase(TypeName(ctrl.Object)) = "CHECKBOX" Then
If ctrl.Object.Value = True Then
ctrl.Object.Value = False
End If
End If
Next
End Sub


--

Dave Peterson