Delete Picture VBA If Then Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is my code and it works: Sheets("T.S.").Shapes("Picture 1").Delete

However, there isn't always a "Picture 1". I would like an If Then
statement. For example:

If Sheets("T.S.").Shapes("Picture 1") = True Then
Sheets("T.S.").Shapes("Picture 1").Delete

Now I know that won't work but you get the idea.
 
How about:

on error resume next
Sheets("T.S.").Shapes("Picture 1").Delete
on error goto 0

Just ignore the error if the picture doesn't exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top