Sorry Amjad - that's what comes of not testing your code before posting! I'm glad you could debug this. As I think you've gathered the reason for my code crashing is because the fully inside test is comparing the address of the shape's range with the address of the intersection between the shape and the wiperange. In the case where there is no overlap, the intersection equates to the nothing object and the address property of the nothing object cannot be resolved hence the error.
There is a slight subtlety to my code which you may have passed over in that I was trying to offer you the option to test whether the shape was fully inside the wiperange or whether there was just any sort of overlap. To be clear, I thought I'd post both tests in case you'd like to implement either of them:
Code:
' Test for any sort of overlap
If Not Intersect(WipeRange, rngShp) Is Nothing Then Shp.Delete
' -------- OR --------
' Test for fully inside
If Not Intersect(WipeRange, rngShp) Is Nothing Then
If Intersect(WipeRange, rngShp).Address = rngShp.Address Then Shp.Delete
End If
Maccas