Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't delete a picture Cerberus Excel Discussion (Misc queries) 5 October 25th 08 04:54 AM
delete picture with macro Steve Excel Discussion (Misc queries) 1 March 16th 06 10:12 PM
Delete Picture Objects The Other Mike Excel Programming 10 February 9th 06 06:12 PM
DELETE A PICTURE TUNGANA KURMA RAJU Excel Discussion (Misc queries) 4 November 24th 05 12:19 PM
Filter and Delete Picture wiwi[_7_] Excel Programming 2 January 4th 04 03:16 PM


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"