I have the following code:
Sub rangeSelect()
Dim r1 As Range, r2 As Range, multiAreaRange As Range, lcopytorow As Long
Worksheets("data").Activate
Set r1 = Range("c9:i9")
Set r2 = Range("m9:af9")
Set multiAreaRange = Union(r1, r2)
LCopyToRow = 2
If Range("L9").Value = "yes" Then
multiAreaRange.Select
Selection.Copy
Sheets("drop").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
LCopyToRow = LCopyToRow + 1
Sheets("data").Select
End If
End Sub
my purpose is to copy the selected ranges into another worksheet called "drop" only if there is "yes" in each corresponding L column. The code works fine for the first item in the table. However, I would need to duplicate it for the whole table (some 3800 rows). I want to avoid copying the entire row but rather only copy the defined ranges as stated above. I assume I would have to define a loop through which the code can jump along,but I am not sure how to do it. Hope my explanation makes sense, new to vba but learning quickly. Any help would be highly appreciated. Thanks guys.