I am using the following code to copy specific column cells to another sheet:
Dim LRow As Long, ChkBx As CheckBox, WS2 As Worksheet
Set WS2 = Worksheets("Sheet2")
LRow = WS2.Range("A" & Rows.Count).End(xlUp).Row
For Each ChkBx In ActiveSheet.CheckBoxes
If ChkBx.Value = 1 Then
LRow = LRow + 1
Range("B" & ChkBx.TopLeftCell.Row, "D" & ChkBx.TopLeftCell.Row).Select
Selection.Copy
WS2.Select
WS2.Range("A" & LRow).Select
ActiveSheet.Paste
End If
Next
Sheets("Sheet2").Activate
I am trying to use the below code to select the specific cells, but it selects the entire range from B to D that also includes C column, whereas i need only B and D column. Is there any way to achieve this? Please suggest the changes (also i am looking for a general solution where where we can achieve this for any number of noncontiguous cells):
Range("B" & ChkBx.TopLeftCell.Row, "D" & ChkBx.TopLeftCell.Row).Select
Bookmarks