ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grouping Userform Controls (https://www.excelbanter.com/excel-programming/323837-grouping-userform-controls.html)

ExcelMonkey[_190_]

Grouping Userform Controls
 
Is is possible to group controls and then adjust them as a
group. Say for example I have 5 option boxes. If I
wanted to make them all =TRUE. Could I do this by
grouping the entire group = TRUE?

I know I can put them all in a frame and refer to the
frame. Will this allow me to do what I want. Can this be
done without using a frame?

Thanks



Tom Ogilvy

Grouping Userform Controls
 
If you are using optionbuttons, then you should use the groupname property
to group them. However, there is no collection or other structure that
allows to deal only with that group or to manipulate them as a group. A
frame would have the same effect, but again, just reduces the number of
controls to be considered.

for each ctrl in Frame1.Controls
if typeof ctrl is MSforms.OptionButton
ctrl.Value = false
end if
Next


for each ctrl in UserForm1.Controls
if typeof ctrl is MSforms.OptionButton
if ctrl.GroupName = "Grp1" then
ctrl.Value = false
end if
end if
Next
setting all optionbuttons to True inconsistent with the way optionbuttons
operate. If you wanted to set them all to true, you would have to assign
them each a different groupname and not use frames.


"ExcelMonkey" wrote in message
...
Is is possible to group controls and then adjust them as a
group. Say for example I have 5 option boxes. If I
wanted to make them all =TRUE. Could I do this by
grouping the entire group = TRUE?

I know I can put them all in a frame and refer to the
frame. Will this allow me to do what I want. Can this be
done without using a frame?

Thanks






All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com