Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default So many option buttons

Assuming that the optionbuttons are from the forms toolbar, if you select
them all and link them to a cell (right-click, Format ControlControl, cell
link), then that cell will contain an index number that you can use in code
or in worksheet functions.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Leith Ross" wrote
in message ...

Hello Rmagic,

The easiest way is to first find the OptionButton that was selected
using a loop.
This code will place the OptionButton number in cell "A1". You can
change the cell to what you need as well as the max loop value of 31.
This code assumes all the OptionButton numbers are sequential.


Code:
--------------------

Dim OB As Object

For I = 1 To 31
Set OB = Controls("OptionButton" & I)
If OB.Value = True Then
Range("A1").Value = I
Exit Loop
End If
Next I

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484513



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
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
Option Buttons Bo0ts Excel Discussion (Misc queries) 4 December 6th 07 03:11 AM
Navigating between option buttons is not selecting the option drhalter Excel Programming 1 June 3rd 05 02:28 PM
Navigating between option buttons is not selecting the option Gixxer_J_97[_2_] Excel Programming 4 June 2nd 05 02:50 PM
Option Buttons Patrick Simonds Excel Programming 4 January 20th 05 04:55 AM


All times are GMT +1. The time now is 10:13 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"