Good afternoon all,
Apologies if this is a stupid question i am new to VB. I am trying to write a simple code to copy the row of data (and possibly formatting) from one sheet (Datasheet) to another (Overdue) if the value in row AE = Yes. I wrote the below which has the issue of copying the actual formulas. Additionally i would like to tell the code to start pasting from cell A2 so i can keep my headings.
Sub Overdue()
Dim lr As Long, lr2 As Long, r As Long
lr = Sheets("Datasheet").Cells(Rows.Count, "AE").End(xlUp).Row
For r = lr To 2 Step -1
If Range("AE" & r).Value = "Yes" Then
Rows(r).Copy Destination:=Sheets("Overdue").Range("A" & lr2 + 1)
lr2 = Sheets("Overdue").Cells(Rows.Count, "A").End(xlUp).Row
End If
Range("A1").Select
Next r
End Sub
Any help would be greatly appreciated.
Pytheus
Bookmarks