Hide Form Control Group Box Borders in Excel with VBA
Question details
Hide the borders of Excel Form Control group boxes that interfere with data entry.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains several Form Control group boxes, and the user wants their outlines out of the way during data entry.
- Observed behavior
- Setting ActiveSheet.GroupBoxes.Visible to False in the VBA Immediate window does not hide the group boxes.
Open the workbook in desktop Excel and select the worksheet containing the Form Control group boxes. Enable macros only if you trust the workbook, and save it as an Excel Macro-Enabled Workbook (.xlsm) if you want to keep the macro.
Hide Form Control group boxes with a VBA macro
Use this macro to hide group box shapes on the active worksheet while leaving other shape types unchanged.
This method hides each entire group box, including its border and caption; it does not make only the border invisible. It targets Form Control group boxes, not ActiveX controls or ordinary shapes.
In desktop Excel, select the worksheet you want to change, then choose Developer > Visual Basic. If the Developer tab is hidden, enable it through Excel's ribbon customization settings.
In the VBA editor, select the workbook in the Project Explorer, then choose Insert > Module.
Paste this code into the module: Sub HideGroupBoxes() Dim shp As Shape For Each shp In ActiveSheet.Shapes If shp.Type = msoFormControl Then If shp.FormControlType = xlGroupBox Then shp.Visible = False End If End If Next shp End Sub
Return to Excel and confirm that the intended worksheet is active. Choose Developer > Macros, select HideGroupBoxes, and click Run.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative for working with spreadsheets in a familiar interface. Open compatible Excel files to make everyday edits and move between office suites more easily; it does not fix Excel's VBA behavior.

Frequently Asked Questions
Does the macro hide only the group box border?
No. Setting the group box shape's Visible property to False hides the entire group box, including its border and caption.
Will the macro hide group boxes on every worksheet?
No. It loops through ActiveSheet.Shapes, so select the worksheet you want to change before running it from Developer > Macros.
How can I make the group boxes visible again?
Open Developer > Visual Basic, change shp.Visible = False to shp.Visible = True in the macro, and run it again on the affected worksheet.
Why does the macro check the shape type first?
It checks shp.Type = msoFormControl before reading FormControlType, so the group box check is applied only to Form Controls rather than other worksheet shapes.
What file type should I use to keep the macro?
Choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm). The .xlsx format cannot retain VBA macros.




