I have no problem running this in a test userform
Do you get a error?
Private Sub CommandButton1_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
ctl.Value = Not ctl.Value
End If
Next ctl
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"Ayo" <(E-Mail Removed)> wrote in message news:7986E7FB-77C1-4801-8610-(E-Mail Removed)...
>I have 7 checkbox and 2 option buttons. One of the option buttons unchecks
> all the checkboxes and the other one checks all the options buttons. In Excel
> 2003 I was able to use somthing like this to do that:
> For Each ctl In InputForm2.Controls
> If TypeName(ctl) = "CheckBox" Then
> If ctl.Value = True Then
> ctl.Value = False
> ElseIf ctl.Value = False Then
> ctl.Value = True
> End If
> End If
> Next ctl
>
> This don't work in Excel 2007. Any ideas
> Thanks