Automatic Button Delition From Worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,

Can someone tell me how to remove ALL the buttons created in a worksheet
without knowing the assigned number of those buttons when they were created.
The number of buttons in the worksheet always varies.

Thank you in advance for your help.
 
Spyren

Buttons from the Forms toolbar or the Control Toolbox?
 
Spyren

Sub DelButtons()

Dim btn As Button

For Each btn In Sheet1.Buttons
btn.Delete
Next btn

End Sub

The Button data type is a deprecated object (I think they want you to use
the Shape object), but it's the best for doing this.
 

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

Back
Top