Hi Everyone,
I have a worksheet(Sheet1) with many rows of data that are presorted so that the most current date which is yesterday would start in Row 2(Row 1 is headers).
What I need is a macro that will SELECT ALL rows with yesterdays date([Today()-1]). The number of rows varies. It could be 3 yesterday and 4 today, etc.
From there I will need to copy the SELECTED rows and paste in Cell A1 in Sheet2.
The code below works but only selects the first row with yesterdays date.
Thanks for any help.
D
End Sub
I have a worksheet(Sheet1) with many rows of data that are presorted so that the most current date which is yesterday would start in Row 2(Row 1 is headers).
What I need is a macro that will SELECT ALL rows with yesterdays date([Today()-1]). The number of rows varies. It could be 3 yesterday and 4 today, etc.
From there I will need to copy the SELECTED rows and paste in Cell A1 in Sheet2.
The code below works but only selects the first row with yesterdays date.
Thanks for any help.
D
End Sub
VBA Code:
Sub FindYesterdaysDateRow()
Dim Rng As Range
Dim YesterD As Date
YesterD = DateAdd("d", -1, Date)
Set Rng = Range("A:A").Find(What:=YesterD, LookIn:=xlValues, LookAt:=xlWhole)
Range("A" & Rng.Row & ":V" & Rng.Row).Select