Trying to delete all pictures in a range. I found the below code online but its throwing a type mismatch error on row:
For Each pic In ws.Pictures
Any input or alternative code is much appreciated.
Sub clearPics()
Dim s As String
Dim pic As Picture
Dim rng As Range
Set ws = Worksheets("sort")
Set rng = ws.Range("c:c")
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
End Sub
Thanks, jj