need to add something to macro delete checkboxes to prevent overlap

asturgill

New Member
Joined
Aug 24, 2014
Messages
3
Can someone help me add to the macro below to delete checkboxes with the row that is being deleted? The row is deleted per the macro, but the ticked checkbox transfers to new sheet.

Sub EndofCycle()
ActiveSheet.Copy After:=ActiveSheet
Columns("AS").Select
Selection.AutoFilter
ActiveSheet.Range("$AS$1:$AS$369").AutoFilter Field:=1, Criteria1:="TRUE"
Cells.Select
Selection.Delete Shift:=x1Up
Range("A1").Select
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try this:

Code:
Sub EndofCycle()
Dim a As Worksheet, i%
ActiveSheet.Copy After:=ActiveSheet
Set a = ActiveSheet
For i = a.Shapes.Count To 1 Step -1
    If InStr(1, a.Shapes(i).Name, "CheckBox") > 0 And a.Range("as" & a.Shapes(i).TopLeftCell.Row).Value _
    = "TRUE" Then a.Shapes(i).Delete
Next
Columns("AS").AutoFilter
a.Range("$AS$1:$AS$369").AutoFilter Field:=1, Criteria1:="TRUE"
Cells.Delete Shift:=xlUp
Range("A1").Select
MsgBox "Sheet has now " & a.Shapes.Count & " shapes", vbInformation
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top