option groups, formatting

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

I have 10 option groups on a form but want to make the
group outlines invisible. Is there a way to do this?

The option groups were placed using the Form menu.
 
Dave,

You can hide group boxes and have the individual groups still operate as
expected. Assuming a naming convention where all of your group boxes have a
name beginning with "grp", the following code will toggle the view of those
groups from visible to hidden:

Sub toggleGroupsHidden()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If Left(shp.Name, 3) = "grp" Then
shp.Visible = Not shp.Visible
End If
Next
End Sub


Charles
www.officezealot.com
 
You can get them all visible/hidden with:

Option Explicit
Sub test01()
ActiveSheet.GroupBoxes.Visible = False
End Sub

Or you could cycle through all the groupboxes:
Sub test02()
Dim GBox As GroupBox
For Each GBox In ActiveSheet.GroupBoxes
GBox.Visible = False
Next GBox
End Sub

Or you could go through the shapes collection
Sub test03()
Dim myShape As Shape
For Each myShape In ActiveSheet.Shapes
If myShape.Type = msoFormControl Then
If myShape.FormControlType = xlGroupBox Then
myShape.Visible = False
End If
End If
Next myShape
End Sub

And if you had some you want visible and some hidden, you could use their names:

ActiveSheet.GroupBoxes("group box 1").Visible = False
 
Back
Top