Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Retrieving OptionButton Control Value

Hello all,

I'm trying to get the values of an option button, but I'm not having any
luck. I'm hoping someone with more experience can help me out. I have very
little experience with the controls and they've stumped me.

I'm trying to retrieve the values from 10 different groups of radio (option)
buttons. I've used the control toolbox controls, not form controls.

I've set the GroupName of the 10 different groups. They are fairly simple.
Reason01...Reason10.

I'm now trying to determine the value of each group. This is being done
from a public module, not the private module of the sheet. So I can't just
use OptionButton1.Value = ? (I tried that too).

I can loop through each OLEObject like so:

Dim o As OLEObject
For Each o In wrk.OLEObjects
If TypeOf o.Object Is MSForms.OptionButton Then
' do something with o.Object.GroupName and o.Object.Value
End If
Next o

But is there some way to specify the GroupName and get the selected radio
value of that group? Looping through doesn't seem very elegant, and I feel I
might be missing something obvious.

Any thought are appreciated.

Thanks,
Jay
--
Disregard, this is so I can find my post later.
***postedbyJay***
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Retrieving OptionButton Control Value

Well, I found a solution, but I don't like it. I just used Linked Cells and
check the cells for the current value. It works, but feels like a
workaround, not a genuine solution.

Cheers,
Jay

--
Disregard, this is so I can find my post later.
***postedbyJay***


"Jay" wrote:

Hello all,

I'm trying to get the values of an option button, but I'm not having any
luck. I'm hoping someone with more experience can help me out. I have very
little experience with the controls and they've stumped me.

I'm trying to retrieve the values from 10 different groups of radio (option)
buttons. I've used the control toolbox controls, not form controls.

I've set the GroupName of the 10 different groups. They are fairly simple.
Reason01...Reason10.

I'm now trying to determine the value of each group. This is being done
from a public module, not the private module of the sheet. So I can't just
use OptionButton1.Value = ? (I tried that too).

I can loop through each OLEObject like so:

Dim o As OLEObject
For Each o In wrk.OLEObjects
If TypeOf o.Object Is MSForms.OptionButton Then
' do something with o.Object.GroupName and o.Object.Value
End If
Next o

But is there some way to specify the GroupName and get the selected radio
value of that group? Looping through doesn't seem very elegant, and I feel I
might be missing something obvious.

Any thought are appreciated.

Thanks,
Jay
--
Disregard, this is so I can find my post later.
***postedbyJay***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Retrieving OptionButton Control Value

I'd use that inelegant loop.

Jay wrote:

Hello all,

I'm trying to get the values of an option button, but I'm not having any
luck. I'm hoping someone with more experience can help me out. I have very
little experience with the controls and they've stumped me.

I'm trying to retrieve the values from 10 different groups of radio (option)
buttons. I've used the control toolbox controls, not form controls.

I've set the GroupName of the 10 different groups. They are fairly simple.
Reason01...Reason10.

I'm now trying to determine the value of each group. This is being done
from a public module, not the private module of the sheet. So I can't just
use OptionButton1.Value = ? (I tried that too).

I can loop through each OLEObject like so:

Dim o As OLEObject
For Each o In wrk.OLEObjects
If TypeOf o.Object Is MSForms.OptionButton Then
' do something with o.Object.GroupName and o.Object.Value
End If
Next o

But is there some way to specify the GroupName and get the selected radio
value of that group? Looping through doesn't seem very elegant, and I feel I
might be missing something obvious.

Any thought are appreciated.

Thanks,
Jay
--
Disregard, this is so I can find my post later.
***postedbyJay***


--

Dave Peterson
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
Retrieving Data: Speed of beating down rows vs retrieving from array? (PeteCresswell) Excel Programming 2 July 9th 07 03:30 PM
for each optionbutton masterphilch Excel Programming 1 September 21st 05 05:37 PM
optionbutton ZX Excel Programming 1 June 9th 05 12:24 PM
optionbutton benb Excel Programming 1 March 29th 05 09:41 PM
OptionButton value Patrick Simonds Excel Programming 2 January 17th 05 10:50 AM


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