Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Delete a shape which name starts with a certain string

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading