Link to home
Start Free TrialLog in
Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on

Delete certain graphic from all worksheets of the current workbook

Dear Experts:

below code is supposed to delete all shapes named "Arrow_75" from all worksheets of the currently active workbook.

Regrettably nothing happens. What is wrong with this code?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas

Sub DeleteCertainShapes()
Dim shp As Shape, ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
  For Each shp In ws.Shapes
     If shp.Name Like "Arrow_75" Then
     shp.Delete
  End If
  Next
Next

End Sub

Open in new window

Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Have you tried = instead of Like?
Please try...

If shp.Name Like "Arrow_75*" Then

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Pleased to help