slayer1957
Board Regular
- Joined
- Jan 9, 2017
- Messages
- 50
I have a few sheets, sheets 1-6 which has a date starting from column "I" and row "2". I have some code that can check a sheet in that column if the date has passed and copy the row to Expired sheet once you click a button.
I just need it to check all specified sheets 1-6 or per name of sheet and copy all data making a list of all the expired rows to the Expired sheet as a Module vba. It must copy data continuing until all rows have been copied.
I just need it to check all specified sheets 1-6 or per name of sheet and copy all data making a list of all the expired rows to the Expired sheet as a Module vba. It must copy data continuing until all rows have been copied.
VBA Code:
Sub License_Check()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastrowa As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Lastrowa = Sheets("Expired").Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 3 To Lastrow
If Cells(i, 9) < Date Then
Rows(i).Copy Destination:=Sheets("Expired").Rows(Lastrowa)
Lastrowa = Lastrowa + 1
End If
Next
Application.ScreenUpdating = True
End Sub