View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dsimcox dsimcox is offline
external usenet poster
 
Posts: 18
Default Clearing Option Buttons

I have a set of 80 Option Buttons (from Control Toolbox) in a questionaire.
I want to clear all of them after a macro posts the results to another sheet.
I can clear them individually with this line in my code like this (for
Option Button 79):

ActiveSheet.OptionButton79.Object.Value = False

For some reason, if I generalize this by trying to clear them with a loop,
it fails.
Here is the code I have tried unsuccessfully to use:

Sub ClearOptBut()
Dim i As Integer
For i = 1 To 80
ActiveSheet.OptionButton(i).Object.Value = False
Next i
End Sub

It hangs up on

ActiveSheet.OptionButton(i).Object.Value = False