Dit zou het moeten worden:
Function Aantal_Werkdagen(Range1, Range2) As Double
Dim Startdatum As Date
Dim Einddatum As Date
Dim TempDate As Date
Startdatum = Range1.Value
Einddatum = Range2.Value
Aantal_Werkdagen = 0
TempDate = Startdatum
If Startdatum >= Einddatum Then
MsgBox "start en einde zijn gelijk.", vbOKOnly, "Error!"
Exit Function
End If
Do While TempDate <= Einddatum
Debug.Print Weekday(TempDate, vbSunday)
If Weekday(TempDate, vbSunday) <> 7 Then _
Aantal_Werkdagen = Aantal_Werkdagen + 1
TempDate = TempDate + 1
Loop
End Function
Met inderdaad =aantal_werkdagen(A1;B1)
in A1 staat de startdatum, in B1 de einddatum
Succes
John