delete pictures from worksheet

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
is there a simple VB code that will remove all pictures from my file? i am currently using the following command to delete picture 2 - but i'm not always sure the picture will be named "pictured 2"....

current code:
ActiveSheet.Shapes("Picture 2").Select
Selection.Delete


thanks!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi

Try

ActiveSheet.Shapes(1).Delete
 
Upvote 0
Me again (",)

Try this:

Sub delete()
For Each shp In Sheets("Yoursheetnamehere").Shapes
shp.delete
Next

End Sub
 
Upvote 0
Me again (",)

Try this:

Sub delete()
For Each shp In Sheets("Yoursheetnamehere").Shapes
shp.delete
Next

End Sub
 
Upvote 0
Adam - your first approach is what i need but i received an error when i tried to use it. Your other approaches rely on me knowing the shape name (that is what i am trying to avoid)

thanks!
 
Upvote 0
question

What error did you receive when using

Code:
Sub deleteshapes
ActiveSheet.Shapes(1).Delete
 
Upvote 0
question

What error did you receive when using

Code:
Sub deleteshapes
ActiveSheet.Shapes(1).Delete
end sub

Did you insert the code into a module?
 
Upvote 0
try this

Adam - your first approach is what i need but i received an error when i tried to use it. Your other approaches rely on me knowing the shape name (that is what i am trying to avoid)
thanks!

I think you may have misunderstood. You dont need to know shape name...Where i put yoursheetnamehere

Put the name of the actual sheet so..."Sheet1"
 
Upvote 0
tried it again.... and now it worked! (i must have had screwed it up the first time)

ActiveSheet.Shapes(1).Delete

thanks Adam!
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,757
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top