ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I delete checkboxes from rows I deleted in a macro? (https://www.excelbanter.com/excel-discussion-misc-queries/65744-how-do-i-delete-checkboxes-rows-i-deleted-macro.html)

Jazzi-D

How do I delete checkboxes from rows I deleted in a macro?
 
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?

Dave Peterson

How do I delete checkboxes from rows I deleted in a macro?
 
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



Jazzi-D wrote:

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?


--

Dave Peterson


All times are GMT +1. The time now is 04:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com