K
Ken Loomis
Not sure what the correct reminology is, but I need to delete all the
buttons on a worksheet.
Currently I use this code:
Sub DeleteButtons()
'
' DeleteButtons Macro
' Macro recorded 3/24/05 by Ken
'
'
ActiveSheet.Shapes("Rectangle 4").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 5").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 8").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 7").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 6").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 3").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 2").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 1").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 9").Select
Selection.Cut
End Sub
But now I realize that if I add a button, I also have to add this:
ActiveSheet.Shapes("Rectangle 9").Select
Selection.Cut
for that new button. Also, it occurs to me that I do not need to select the
button first to delete it.
In pseudo code I think it would be something like this:
For each button in the collection of buttons on this sheet
Delete this button
Next Button
Can someone please suggest the VBA code that will do this? It woul dbe
helpful if you could suggest the syntax to specifiy a specific worksheet in
the active workbook, since the buttons are only on the "Start Here"
worksheet
Thanks,
Ken
buttons on a worksheet.
Currently I use this code:
Sub DeleteButtons()
'
' DeleteButtons Macro
' Macro recorded 3/24/05 by Ken
'
'
ActiveSheet.Shapes("Rectangle 4").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 5").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 8").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 7").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 6").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 3").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 2").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 1").Select
Selection.Cut
ActiveSheet.Shapes("Rectangle 9").Select
Selection.Cut
End Sub
But now I realize that if I add a button, I also have to add this:
ActiveSheet.Shapes("Rectangle 9").Select
Selection.Cut
for that new button. Also, it occurs to me that I do not need to select the
button first to delete it.
In pseudo code I think it would be something like this:
For each button in the collection of buttons on this sheet
Delete this button
Next Button
Can someone please suggest the VBA code that will do this? It woul dbe
helpful if you could suggest the syntax to specifiy a specific worksheet in
the active workbook, since the buttons are only on the "Start Here"
worksheet
Thanks,
Ken