Hello Mathematicus,
Welcome to the Forum!
This macro will all Forms type and ActiveX, aka Control Toolbox, controls. All other object are left intact: Charts, comments, pictures, workbook links, etc. Copy this code to standard VBA module in your workbook.
Sub RemoveControls()
Dim Shp As Shape
Dim Wks As Worksheet
For Each Wks In Worksheets
For Each Shp In Wks.Shapes
If Shp.Type = 8 Or Shp.Type = 12 Then
Shp.Delete
End If
Next Shp
Next Wks
End Sub
Adding the Macro (Excel 95 - 2003)- Copy the macro above pressing the keys CTRL+C
- Open your workbook
- Press the keys ALT+F11 to open the Visual Basic Editor
- Press the keys ALT+I to activate the Insert menu
- Press M to insert a Standard Module
- Paste the code by pressing the keys CTRL+V
- Make any custom changes to the macro if needed at this time.
- Save the Macro by pressing the keys CTRL+S
- Press the keys ALT+Q to exit the Editor, and return to Excel.
To Run the Macro...
To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
Bookmarks