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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top