Hi there,
I have gone this far so far regarding using VBA to copy and paste rows into another worksheet based on condition. I have also attached the file for you to refer to. I'm really stuck here.
So the idea here is....to copy and paste rows where column L's data contains "Yes" into another worksheet.
Dim i As Long
Dim j As Long
Dim c As Long
Dim ccm As Range
Set ccm = Range("L3:L6000000")
For c = 2 To 60000000
If ccm.Cells(i, j).Value = "Yes" Then
Rows(i, j).Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Paste
c = c + 1
Else
MsgBox "No CCM encounters found"
End If
Next j
Next i
End Sub
I keep getting the error message saying "invalid next reference".
Bookmarks