Macro: Help

  • Thread starter Thread starter Bland
  • Start date Start date
B

Bland

I have designated a space in my excel document where I
place screen shots using ALT+Print Screen and Paste. I
would like to create a macro that would delete the screen
shots for me when I need to refresh my form. When I try
to create the macro, I run into problems because it looks
to delete the specific picture (example picture 57), but I
just want it to generically delete pictures. Is that
possible? Am I even making sense?

Thank you
 
Bland,

VBA will do it

For Each pic In ActiveSheet.Pictures
pic.Delete
Next


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks a million!!!!!

I do have one last question. Is there a way to have it
delete every picture but one?
 
Yes, just test for the particular picture, such as

For Each pic In Activesheet.Pictures
If pic.Name <> "Picture 1" Then
pic.Delete
End If
Next pic

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
I must have done something wrong. I put your code in and
then changed Picture 1 to the name of the picture that I
want to preserve and it still deleted everything.
 
Bland,

It does work, I tested it to be sure.

Are you sure you got the name right, including all spaces?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top