View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Option Button Grouped

I'm not surprised your code doesn't work but I am surprised not to be able
to change a grouped Forms optionbutton after referencing it within the
Group.

If you can use an ActiveX option button then the following works

Sub test()
Dim shp As Shape, giShp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Name = "Group 3" Then
For Each giShp In shp.GroupItems
If giShp.Name = "OptionButton1" Then
With giShp.DrawingObject.Object
.Value = Not .Value
End With

End If
Next
End If
Next
End Sub

Regards,
Peter T

wrote in message
ups.com...
I have a option button and label grouped and what of set the option
button to value xlon. I cannot seem to be able to set the value when
it's grouped.

I have been trying this which finds the option button but will not set
the value.

Dim ob As OptionButton

For Each ob In ActiveSheet.OptionButtons
If ob.Name = "Group 498" Then
ob.Value = xlOn
End If
Next


I get error 'Run-time error 1004': Unable to set the value property of
the optionbutton class.

Can somebody tell me where I'm going wrong.

Thank you.