How do I delete checkboxes from rows I deleted in a macro?

J

Jazzi-D

I programmatically delete a named range which contains checkboxes, but after
the rows have been deleted the checkboxes overlay each other and appear in a
blank line. Is there any way to delete the checkboxes as well as the content
of the cells/rows?
 
D

Dave Peterson

Maybe you could do something like:

Option Explicit
Sub testme99()
Dim myShape As Shape
Dim myRng As Range
Dim wks As Worksheet

Set wks = Worksheets("Sheet1")

With wks
Set myRng = .Range("g8:k20") 'whatever
For Each myShape In .Shapes
If Intersect(myShape.TopLeftCell, myRng) Is Nothing Then
'don't delete it
Else
myShape.Delete
End If
Next myShape
End With
myRng.Delete shift:=xlUp

End Sub
 
Top