This article demonstrates a macro that copies selected rows based on enabled check boxes. The image above shows data on Sheet1 and checkboxes, some of them are enabled and those will be copied to Sheet2 if you click button "Copy selected rows".
The image above shows Sheet2 and records copied from Sheet1.
'Name of macro
'Go through each check box in active sheet
For Each chkbx In ActiveSheet.CheckBoxes
'If check box is enabled
If chkbx.Value = 1 Then
'Go through each row on worksheet
For r = 1 To Rows.Count
'Check if checkbox is on the same row
If Cells(r, 1).Top = chkbx.Top Then
'Identify the cell right below the last non empty cell
LRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
'Copy record from Sheet1 and paste to first empty row on Sheet2
.Range("A" & LRow & ":D" & LRow) = _
Worksheets("Sheet1").Range("A" & r & ":D" & r).Value
'Exit For Loop
Where to copy vba code?
Copy above code
Press Alt+F11 in excel
Insert a module
Paste code into code window
Return to excel
I have assigned the macro to a button: Copy selected rows