The code below gives me the total number of days in a month. But I would like only the working days. There are many examples using the NetworkDays function but this function is not available in VBA (as far as I can see). Can someone help?
Code:
Sub FillWeekdays()
Dim x As Long
Dim m As Integer
Dim y As Integer
Dim DaysInMonth As Integer
Dim DestinationRange As Range
Dim SourceRange As Range
With Worksheets("Data")
' define last empty row
x = .Range("B65536").End(xlUp).Row + 1
' add new starting date
.Range("A" & x).Value = frmInput.cboMonth.Text & " 1, " & _
frmInput.cboYear.Text
' define variable for number of the month
m = Month(.Range("A" & x).Value)
' define variable for the year
y = frmInput.cboYear.Text
' get number of days in month
DaysInMonth = DateSerial(y, m + 1, 1) - DateSerial(y, m, 1)
End With
End Sub