Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Clearing Option Buttons

Hi
try (not tested):
Sub ClearOptBut()
Dim i As Integer
For i = 1 To 80
with ActiveSheet.controls("OptionButton" & i)
.Value = False
end with
Next i
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany

"dsimcox" schrieb im Newsbeitrag
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing Option Buttons pdaws Excel Discussion (Misc queries) 3 March 25th 09 09:10 PM
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
option buttons help kb Excel Worksheet Functions 2 June 18th 07 11:06 PM
option buttons CAOU Excel Worksheet Functions 1 April 20th 06 09:17 AM
option buttons marwan hefnawy Excel Programming 3 May 4th 04 06:32 PM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"