tjlaser shepard
New Member
- Joined
- Jun 1, 2016
- Messages
- 7
I am writing a macro to try and sort some payroll information. On the worksheet, column "I" contains the "payroll end dates" for accounting records in the spreadsheet. I have used the following section of code to find the max date column "I" and assign it to a variable:
Dim lastEndDate As Long
With ThisWorkbook.Sheets("100")
lastEndDate = WorksheetFunction.Max(Range("I:I"))
End With
This works fine for finding the latest date, but I need a way to make it more specifically the latest Saturday. Is there someway to incorporate the WEEKDAY function or something else to specify that the date stored in lastEndDate must be a Saturday? Thanks
Dim lastEndDate As Long
With ThisWorkbook.Sheets("100")
lastEndDate = WorksheetFunction.Max(Range("I:I"))
End With
This works fine for finding the latest date, but I need a way to make it more specifically the latest Saturday. Is there someway to incorporate the WEEKDAY function or something else to specify that the date stored in lastEndDate must be a Saturday? Thanks