Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() hello again I have a form with 31 option buttons (for different colours) and command button How do i send which option button (which number) has been selected to sheet cell from the command button only 1 selection is poss Thank yo -- Rmagi ----------------------------------------------------------------------- Rmagic's Profile: http://www.excelforum.com/member.php...fo&userid=2859 View this thread: http://www.excelforum.com/showthread.php?threadid=48451 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Rmagic, The easiest way is to first find the OptionButton that was selecte using a loop. This code will place the OptionButton number in cell "A1". You ca 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 Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48451 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Leith,
Exit Loop I am sure you intended: Exit For --- Regards, Norman "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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Norman, Thanks for catching that mistake. I'm sure Rmagic appreciates it a well. Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48451 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for the help i will give it a g -- Rmagi ----------------------------------------------------------------------- Rmagic's Profile: http://www.excelforum.com/member.php...fo&userid=2859 View this thread: http://www.excelforum.com/showthread.php?threadid=48451 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Option Buttons/Radio Buttons | New Users to Excel | |||
Option Buttons | Excel Discussion (Misc queries) | |||
Navigating between option buttons is not selecting the option | Excel Programming | |||
Navigating between option buttons is not selecting the option | Excel Programming | |||
Option Buttons | Excel Programming |