I can't find anything on NetWorkDays within VBA. Closest I came to was some truncated code here, which I took a stab at (seems to work)
[vba]
Sub Populate()
Dim rFund As Range, PayDate As Range
Dim Fund As Long
Dim rTot As Range
Dim FirstAddress As String
With Sheets("Sheet1").Columns(1)
'Find first Paid & Wait (P&W)
Set rTot = .Find(What:="PAID & WAIT TOTAL", _
LookIn:=xlValues, lookat:=xlPart)
FirstAddress = rTot.Address
Do
'If no P&W value then find next
If Not rTot Is Nothing And rTot.Offset(, 1) < 1 Then
Do
Set rTot = .FindNext(rTot)
Loop Until Not rTot.Offset(, 1) < 1
'With P&W value, find Fund value
Set rFund = .Find(What:="FUND #:", LookIn:=xlValues, _
lookat:=xlPart, After:=rTot)
Fund = Mid(rFund, 9, 4)
'Check PayDate and infill data
Set PayDate = rTot.End(xlUp)
If BizDateDiff(PayDate, Date, 1) <= 8 Then
Call GetData(rTot, PayDate, Fund)
End If
End If
'Find new P&W value
Set rTot = .Find(What:="PAID & WAIT TOTAL", _
LookIn:=xlValues, lookat:=xlPart, After:=rTot)
Loop While Not rTot Is Nothing And rTot.Address <> FirstAddress
End With
End Sub
Sub GetData(rTot As Range, PayDate As Range, Fund As Long)
Dim tgt As Range
Set tgt = Sheets("Paid & Wait").Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(, 10)
tgt(1) = Fund
tgt(2) = Split(rTot)(0)
tgt(3) = PayDate
tgt(4) = Split(PayDate.Offset(-1))(2)
tgt(5) = Split(PayDate.Offset(-1))(3)
tgt(6) = PayDate.Offset(-1, 1)
tgt(7) = PayDate.Offset(-1, 2)
tgt(8) = PayDate.Offset(-1, 5)
tgt(9) = PayDate.Offset(-1, 6)
End Sub
Public Function BizDateDiff(ByVal varDateStart As Date, ByVal varDateEnd As Date, DayNumber) As Integer
' DayNumber (sunday =1,monday=2…)
Dim varNextDate As Date
'This function calculates the weekdays between two dates.
'Exit if variables not a valid date
If Not IsDate(varDateStart) Or Not IsDate(varDateEnd) Then
BizDateDiff = 0
Exit Function
End If
varNextDate = varDateStart
BizDateDiff = 0
While Not varDateEnd < varNextDate
If Weekday(varNextDate) <> 1 And Weekday(varNextDate) <> 7 Then
BizDateDiff = BizDateDiff + 1
End If
varNextDate = varNextDate + 1
Wend
End Function
[/vba]