Greetings
I am trying to work out a formula that states
if column J contains "NO" then copy that row and paste in a second sheet (which has already data on it).
A friend helped me on that and created the below formula:
[VBA]Sub Test()
For Each Cell In Sheets(1).Range("J:J")
If Cell.Value = "NO" Then
matchRow = Cell.Row
Rows(matchRow & ":" & matchRow).Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End If
Next
End Sub[/VBA]
While it relatively works, the problem is that it copies the entire row in sheet's 2 Row 1 (because the initial data were in sheet's 1 row 1). But in sheet 2 i have other rows covered with other data and i do not want to replace them. I just want the vba code to copy the line IN THE FIRST NEW ROW that HAS NO DATA in it (e.g let's say row 15 but that is constantly changing).
How could i do that? Can someone help as i am vba noob?
P.S i "guess" it is smth with ActiveSheet.Rows(matchRow).Select line, but i m not 100% sure