lady_alina
Board Regular
- Joined
- Feb 18, 2015
- Messages
- 52
Hi,
I have data in sheet1 and check box in column A against each line. I want to copy the data in next sheet when check box is checked, however the code that I have works only for each check box and it is a very tideous procedure and it doesn't really help much.
What I want is a code that will work for all check boxes (count of check box will be around 5000). The code should identify the available empty row and copy the checked data at once in the next available row in the other sheet. Also headers are not copied so want a solution for that as well. If the checked checkbox is unchecked then the data should be remove from that sheet and row should be deleted or the lines below that should move up. Hope my question makes sense.
I have data in sheet1 and check box in column A against each line. I want to copy the data in next sheet when check box is checked, however the code that I have works only for each check box and it is a very tideous procedure and it doesn't really help much.
What I want is a code that will work for all check boxes (count of check box will be around 5000). The code should identify the available empty row and copy the checked data at once in the next available row in the other sheet. Also headers are not copied so want a solution for that as well. If the checked checkbox is unchecked then the data should be remove from that sheet and row should be deleted or the lines below that should move up. Hope my question makes sense.
Code:
Private Sub CheckBox1_Click() With Sheets("Checkout")
ckrownum = .Cells(Rows.Count, "B").End(xlUp).Row
If CheckBox1 Then
Range("B1:D1").copy
.Range("B" & ckrownum).PasteSpecial
Else
For x = 1 To ckrownum
If .Cells(ckrownum, 2) = Cells(1, 2) Then
.Rows(ckrownum).Delete
Exit For
End If
Next
End If
End With
End Sub