deleting form controls by code

  • Thread starter Thread starter Bri
  • Start date Start date
B

Bri

Hello

I' like to USE CODE to delete controls from a worksheet. I hope to use the
code on several sheets.

I used 'Record Macro' to come up with the following, which works well on the
1st sheet ...

Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shape.Range(Array("chbx1", "chbx2", "optbx1")).Select
Selection.Delete
Application.CommandBars("Drawing").Visible = False

The problem is that different sheets have different numbers of controls,
sometimes with different names, so the Array part of the code above crashes.
What code can I use to delete all form controls from a given page?

Thank you
Bri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Stripping down excel 2
auto enable macros 5
Shared Workbook 12
MAJOR PROBLEM! --- Menu Bars don't unhide? 9
Disable the Delete Control in the Edit Menu 1
Drawn Objects Q 2
Controlling user environment 3
Workbook_close 1

Back
Top