Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array of OptionButtons ?

I have an application with a userform that uses optionbuttons. Th
number of optionbuttons is dynamically defined by the application. Th
buttons are presently "optionbutton1", "optionbutton2", etc (i.e., th
default names). Is there a way to manipulate the option buttons as a
array, i.e., something like optionbutton(i) ? I have tried somethin
like

Dim opButton as OptionButton

I = 0
For each opButton in frmSelectPro

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array of OptionButtons ?

Dim obtn as MSForms.OptionButton
for each ctrl in userform1.controls
if typeof ctrl is MSForms.OptionButton then
set obtn = ctrl
msgbox obtn.Name
end if
Next


--
Regards,
Tom Ogilvy


"MWE " wrote in message
...
I have an application with a userform that uses optionbuttons. The
number of optionbuttons is dynamically defined by the application. The
buttons are presently "optionbutton1", "optionbutton2", etc (i.e., the
default names). Is there a way to manipulate the option buttons as an
array, i.e., something like optionbutton(i) ? I have tried something
like

Dim opButton as OptionButton

I = 0
For each opButton in frmSelectProj


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array of OptionButtons ?

Tom Ogilvy wrote:
[b]Dim obtn as MSForms.OptionButton
for each ctrl in userform1.controls
if typeof ctrl is MSForms.OptionButton then
set obtn = ctrl
msgbox obtn.Name
end if
Next
--
Regards,
Tom Ogilvy



Tom: thanks, this works.

MW

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Array of OptionButtons ?

Use this: assumes you are using default optionbutton names
Private Sub GetOpts(
Dim c As Contro
For Each c In Control
If c.Name Like "optionbutton*" the
. ..Your code her
End i
Nex
End Su
----- MWE wrote: ----

I have an application with a userform that uses optionbuttons. Th
number of optionbuttons is dynamically defined by the application. Th
buttons are presently "optionbutton1", "optionbutton2", etc (i.e., th
default names). Is there a way to manipulate the option buttons as a
array, i.e., something like optionbutton(i) ? I have tried somethin
lik

Dim opButton as OptionButto

I =
For each opButton in frmSelectPro


--
Message posted from http://www.ExcelForum.com


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
UserForm OptionButtons Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 4th 07 07:52 PM
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
Add OptionButtons in Excel Andrew Lenczycki Excel Programming 0 July 30th 03 02:34 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 07:00 AM.

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"