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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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