Deleting an ambiguous shape name
You will need to check each object individually to see if it's in the range
you want to keep. Following should delete all pictures except any that is
entirely or partly within columns C:E
Sub test()
Dim rngKeep As Range
Dim pic As Picture
Set rngKeep = ActiveSheet.Range("C:E")
For Each pic In ActiveSheet.Pictures
If Intersect(ActiveSheet.Range(d.TopLeftCell, d.BottomRightCell), rngKeep)
Is Nothing Then
pic.Delete
End If
Next
End Sub
Might be worth naming any pictures you know you will want to keep, eg
if instr(1, pic.name "keep") = 0 then pic.delete
Regards,
Peter T
"WBTKbeezy" wrote in message
...
That is an awesome solution. Is there a way that could be done in just one
range of the worksheet? (I didn't realize I was deleting another picture I
didn't want deleted.)
"Peter T" wrote:
One more, simply -
ActiveSheet.Pictures.Delete ' all pictures, if any
Regards,
Peter T
"WBTKbeezy" wrote in message
...
Hello:
I am trying to write/record a macro that will clear out a worksheet in
specific ranges. It is easy to deal with the text portions, but the
worksheet
also contains a picture that also needs to be deleted, but the picture
is
different each week and always has a different name. Is there a way to
select
a shape if I can't pinpoint the name value?
Thanks.
|