+ Reply to Thread
Results 1 to 2 of 2

Delete Picture VBA If Then Problem

  1. #1
    Shawn
    Guest

    Delete Picture VBA If Then Problem

    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.



    --
    Thanks
    Shawn

  2. #2
    Dave Peterson
    Guest

    Re: Delete Picture VBA If Then Problem

    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.

    Shawn wrote:
    >
    > 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.
    >
    > --
    > Thanks
    > Shawn


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1