G
GerryK
Hi,
Function GetWorkDays(StartDate As Long, EndDate As Long)
As Long
' returns the count of days between StartDate - EndDate
minus Saturdays and Sundays
Dim d As Long, dCount As Long
For d = StartDate To EndDate
If WeekDay(d, vbMonday) < 6 Then
dCount = dCount + 1
End If
Next d
GetWorkDays = dCount
End Function
With a date in A2 and B2 and in C2 =GETWORKDAYS(A2:B2) I
do not get the expected result, rather get #value.
I've got the VBA in Sheet and inserted module?
Can someone tell why it is not working, (using 2000)?
Function GetWorkDays(StartDate As Long, EndDate As Long)
As Long
' returns the count of days between StartDate - EndDate
minus Saturdays and Sundays
Dim d As Long, dCount As Long
For d = StartDate To EndDate
If WeekDay(d, vbMonday) < 6 Then
dCount = dCount + 1
End If
Next d
GetWorkDays = dCount
End Function
With a date in A2 and B2 and in C2 =GETWORKDAYS(A2:B2) I
do not get the expected result, rather get #value.
I've got the VBA in Sheet and inserted module?
Can someone tell why it is not working, (using 2000)?