View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Does an object exist?

Hi Paul

One way is to use On Error Resume Next


On Error Resume Next
ActiveSheet.Shapes("yourshapename").Delete
On Error GoTo 0


More info here
http://www.rondebruin.nl/controlsobjectsworksheet.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Paul Pedersen" wrote in message ...
I need to find an object (in this case, a picture) on a worksheet, and if it
exists, delete it. I will know ahead of time the name of the object, but how
can I avoid an error message by trying to delete it if it's not there?