View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Visual Basic code

Hi,

If they are option buttons from the Control toolbox, then try something like
this:

Sub test()

Dim o As OLEObject

For Each o In ActiveSheet.OLEObjects
If TypeName(o.Object) = "OptionButton" Then
o.Delete
End If
Next o

End Sub


If they are option buttons from the Forms toolbox, then something like this:

Sub test2()

Dim b As OptionButton

For Each b In ActiveSheet.OptionButtons
b.Delete
Next b

End Sub



--
Hope that helps.

Vergel Adriano


"RitaJ" wrote:

I have somehow got thousnads of option buttons in my Excel worksheet. I would
like to write a simple code that would remove them using a macro instead of
manually deleting them. The option buttons are not in continuos numbers so
the code needs to check if the button exists first and then delete.

I am a novice and cannot write the above code.

Thanks