![]() |
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 |
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/ |
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 |
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 |
All times are GMT +1. The time now is 06:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com