Hope someone can help.....
I have a worksheet "Proposal" which has some forms buttons, some forms 'tick boxes' and some rectangles drawn with the Drawing rectangle tool.
I want to use a macro to delete any and all of the above which fall into the Range A5:AE190
I have tried:
Sub ShapesInRangeDelete()
Dim sh As Shape
Dim ws As Worksheet
Set ws = Worksheets("Result")
Set Rng = ws.Range("A5:AE190")
For Each sh In ws.Shapes
If Not Application.Intersect(sh.TopLeftCell, Rng) Is Nothing Then
sh.Delete
End If
Next sh
End Sub
...but get a an "Application defined or Object defined error" on the "If Not...." line.
Can someone offer some suggestions.......
Thanks in advance
I have a worksheet "Proposal" which has some forms buttons, some forms 'tick boxes' and some rectangles drawn with the Drawing rectangle tool.
I want to use a macro to delete any and all of the above which fall into the Range A5:AE190
I have tried:
Sub ShapesInRangeDelete()
Dim sh As Shape
Dim ws As Worksheet
Set ws = Worksheets("Result")
Set Rng = ws.Range("A5:AE190")
For Each sh In ws.Shapes
If Not Application.Intersect(sh.TopLeftCell, Rng) Is Nothing Then
sh.Delete
End If
Next sh
End Sub
...but get a an "Application defined or Object defined error" on the "If Not...." line.
Can someone offer some suggestions.......
Thanks in advance