Remove Multiple Nested Macro Buttons

Gerard McInerney

New Member
Joined
Jun 14, 2014
Messages
6
Office Version
  1. 2007
Platform
  1. Windows
I have a worksheet which holds various information for 100 nights over a 12 month period (data entered for 2 nights per week). I have a Macro Button next to each night (100 buttons) which runs the same macro.
I no longer require this macro so I deleted it. I decided to remove the macro buttons only to discover that the buttons have nested on top of each other. I am speaking about hundreds of buttons in each case.
I have manually removed the buttons for the first 60 nights which was a very laborious task. Example night 50 had 330 buttons nested & the numbers seem to multiply the further down I go on my sheet - night 60 had nearly 500 buttons. I cannot explain how this has happened. I did copy the first nights data down to create the others. The file is in use for a number of years.
My question is: can I remove the buttons any quicker way other than cutting. I am using Excel 2007 with Windows 7.
Any help would be appreciated.
Gerard McInerney
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Place this code into the sheet module for the sheet containing the buttons. When you run it, it will delete all buttons on the sheet. Be careful because if you have any other controls or shapes, it will delete those too.

VBA Code:
Private Sub RemoveButtons()

   Dim S As Shape
   
   For Each S In Shapes
      S.Delete
   Next S

End Sub
 
Upvote 0
Another option, which will also delete all buttons, shapes etc.
VBA Code:
Sub GerardMcinerney()
  Shapes.SelectAll
  Selection.Delete
End Sub
 
Upvote 0
ActiveSheet.DrawingObjects.Delete

I'm glad to report that this one worked perfectly
This will save me a lot of time.
Thanks for the help
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top