How can I delete a shape which starts with a certain string?
No need for a loop(?) There is only one "MyButton", but with different number after "MyButton".
worksheets("sheet1").Shapes("MyButton" & "*").Delete
CodePudding user response:
You need to loop to check the names.
Dim shp As Shape
For Each shp In Worksheets("Sheet1").Shapes
If shp.Name Like "MyButton*" Then
shp.Delete
End If
Next shp