billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Hello all
Trying to copy all rows to another sheet if column 8 value is not today's date.
this is the loop I am using.
Thank you
Sub copyif()
Dim Lr As Long, lr2 As Long
Lr = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
lr2 = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To Lr
If Sheets("Report").Cells(i, 8).Value < Date Then
Rows(i).Copy Destination:=Sheets("Sheet1").Range("A").End(xlUp).Row
lr2 = Sheets("sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Report").Rows(1).Copy Destination:=Sheets("Sheet1").Rows(1)
End If
Next i
End Sub
Trying to copy all rows to another sheet if column 8 value is not today's date.
this is the loop I am using.
Thank you
Sub copyif()
Dim Lr As Long, lr2 As Long
Lr = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
lr2 = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To Lr
If Sheets("Report").Cells(i, 8).Value < Date Then
Rows(i).Copy Destination:=Sheets("Sheet1").Range("A").End(xlUp).Row
lr2 = Sheets("sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Report").Rows(1).Copy Destination:=Sheets("Sheet1").Rows(1)
End If
Next i
End Sub