Removing Buttons

S

Steven Stadelhofer

I copied buttons from a WEB page into an EXCEL
spreadsheet. I tried to remove the buttons using edit/go
to/special/objects -- but it says 'no objects found'. I
also tried to 'right click' the button and cut - but it
did not work either. I can send you a sample if possible.
 
D

Dave Peterson

If there's no shapes you want to keep, maybe this'll do it for you.

(Save your file first--just in case.)

Option Explicit
Sub testme()

Dim iCtr As Long
Dim myErrNumber As Long

With ActiveSheet
.Shapes.SelectAll
On Error Resume Next
Selection.Delete
myErrNumber = Err.Number
On Error GoTo 0

If myErrNumber <> 0 Then
For iCtr = .Shapes.Count To 1 Step -1
.Shapes(iCtr).Delete
Next iCtr
Err.Clear
End If
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
S

Steve Stadelhofer

Dave,

Thanks for reply and sorry for the delayed re-post. I
was trying to use your macro but got several error msg.
Since I am not real familiar with writing and using
macros are you aware of a way to remove buttons without
using a macro?

Thanks Steve
 
Top