LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Better Way to Use OptionButton

for i = 1 to 12
if Userform.Controls("OptionButton" & i).Value = True then
b = i - 1
end if
Next

--
Regards,
Tom Ogilvy

" wrote in message
...
Hi -

I'm trying to clean up some code related to OptionButtons on a
UserForm. Depending on what button someone selects, a variable that is
used elsewhere in the code gets set.

Here's my inefficient code:

If UserForm.OptionButton1.Value = True Then
b = 0
End If
.
.
. and so on until
If UserForm.OptionButton12.Value = True Then
b = 11
End If

I suspect there is some way to do this with Select Case, but I haven't
been able to get it to work yet...

Thanks in advance



 
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
How Do I Tab From An OptionButton To A TextBox Minitman Excel Discussion (Misc queries) 0 February 23rd 05 09:34 PM
which optionbutton is on Keyur Excel Programming 1 July 25th 04 05:49 AM
OptionButton problem Paul Excel Programming 1 June 14th 04 01:33 PM
optionbutton in userform Tom Ogilvy Excel Programming 0 June 1st 04 03:45 PM
optionbutton in userform Chico!! Excel Programming 0 June 1st 04 03:31 PM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"