Hi all im trying to create a macro that will copy data from source data to a new sheet when the data in column B=A, this is what i have come up with but gives errors ; where am i going wrong ?
THX
Sub copytoworksheet()
finalrow = Cells(Rows.Count, 2).End(xlUp).Row
For i = 1 To finalrow
If Cells(i, 2) = "A" Then
lastRow = Sheets("New").Range("A" & Rows.Count).End(xlUp).Row + 1
EntireRow.Copy Destination:=Sheets("New").Range("A" & lastRow)
End If
Next i
End Sub
THX
Sub copytoworksheet()
finalrow = Cells(Rows.Count, 2).End(xlUp).Row
For i = 1 To finalrow
If Cells(i, 2) = "A" Then
lastRow = Sheets("New").Range("A" & Rows.Count).End(xlUp).Row + 1
EntireRow.Copy Destination:=Sheets("New").Range("A" & lastRow)
End If
Next i
End Sub