Need help in using a variable in the following IF statement:
Dim LastHldy As Date
Dim MaxLT As Long
Dim Holidays As String
LastHldy = Worksheets("Holidays").Cells(LastHldyRow, 1).Value
Holidays = "Holidays!$B2:$B" & LastHldyRow
MaxLT = [Max(ItemMaster!H:H)]
'The result of the Holidays assignment is Holidays!$B2:$B12
IF WorksheetFunction.[NetworkDays.INTL([Today()], LastHldy, 11, Holidays)] < MaxLT Then
the macro executes but I get the error "object doesn't support this property or method.
When I try the following:
IF WorksheetFunction.NetworkDays.INTL([Today()], LastHldy, 11, Holidays) < MaxLT Then
The macro does NOT execute and I get the error "Argument not optional" and .NetworkDays is highlighted.
The code works if I take out the Holidays variable.
This works: If WorksheetFunction.NetworkD