C
caroline
hello,
I am using this code found in Search results:
It works very well on a new workbook/sheet, but when I try to use it on my
existing workbook/sheet, it gives me error 13 on that line "For Each pic In
ws.Pictures"
Any pointer would be most welcome. This is driving me crazy.
Thanks
here's the full code
Dim s As String
Dim pic As Picture
Dim rng As Range
Set ws = ActiveSheet
Set rng = ws.Range("F11:J32")
For Each pic In ws.Pictures
With pic
s = .TopLeftCell.Address & ":" & .BottomRightCell.Address
End With
If Not Intersect(rng, ws.Range(s)) Is Nothing Then
pic.Delete
End If
Next
I am using this code found in Search results:
It works very well on a new workbook/sheet, but when I try to use it on my
existing workbook/sheet, it gives me error 13 on that line "For Each pic In
ws.Pictures"
Any pointer would be most welcome. This is driving me crazy.
Thanks
here's the full code
Dim s As String
Dim pic As Picture
Dim rng As Range
Set ws = ActiveSheet
Set rng = ws.Range("F11:J32")
For Each pic In ws.Pictures
With pic
s = .TopLeftCell.Address & ":" & .BottomRightCell.Address
End With
If Not Intersect(rng, ws.Range(s)) Is Nothing Then
pic.Delete
End If
Next