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


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default So many option buttons


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default So many option buttons

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default So many option buttons


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   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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default So many option buttons


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
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 11:37 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"