Workday Function to add Workdays

excel, function, vba

Solution

To use the worksheet Workday() function within VBA:

Sub WhyWork()
    Dim d1 As Date, wf As WorksheetFunction
    Set wf = Application.WorksheetFunction
    d2 = wf.WorkDay(Date, 30)
    MsgBox Date & vbCrLf & d2
End Sub

Problem

I'm trying to run code based off of dates in the D column. The code below works. But the "if" part of the conditional formatting needs to be + 30 workdays, not plus thirty days. I'm assuming that the WORKDAY function helps with this. But when I try + workday(30) and things like that, I don't get anywhere. ``` For Each oKey In oDictionary.keys Editing_Sheet.Range("A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=CStr(oKey) LastRowFiltered = Editing_Sheet.Cells(Rows.Count, "A").End(xlUp).Row If Range("D" & LastRowFiltered) <= Date + 30 Then 'run code' ```

Original source