Hi, my company has a Data tab where it has all the contract. It has all the expiry date. As and when, the admin will manually copy and paste those expired contract to another sheet call "Expiry". I am thinking of writing a VBA which will Copy and paste those Expired Contract to the "Expiry" tab. Hence i write the code whenever the "Expiry" tab is activated.
Private Sub Worksheet_Activate()
Dim datalastrow As Long, expirylastrow As Long, i As Integer
Dim aaa As Long
datalastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To datalastrow
If Sheets("Data").Cells(i, 1) < Date Then
Sheets("Data").Rows(i).Copy
expirylastrow = Sheets("Expiry").Cells(Rows.Count, 1).End(xlUp).Row
aaa = expirylastrow + 1
Sheets("Expiry").Rows(aaa).PasteSpecial
End If
Next i
Application.CutCopyMode = False
End Sub
I realise that the Expired data will repeat whenever i select Expiry tab. Hence making it useless... Is there a way to solve it? i know i can solve the problem by adding a Clear Content on top. But i believe there is a better way to do it. Please advice.... =)
Bookmarks