Function CalcDate(FirstDate [COLOR=blue][B]As Date[/B][/COLOR], ByVal PreviousCell [B][COLOR=blue]As Date[/COLOR][/B], DaysOff As Range) [COLOR=blue][B]As Date[/B][/COLOR]
[COLOR=blue][B]Application.Volatile[/B][/COLOR]
Dim [B][COLOR=blue]Cell As Variant[/COLOR][/B], Res As Date
If IsDate(FirstDate) = True Then
If Weekday(PreviousCell, vbMonday) = 5 Then
Res = PreviousCell + 3
Else
Res = PreviousCell + 1
End If
For Each Cell In DaysOff
If Cell = Res Then
Res = CalcDate(FirstDate, [COLOR=blue][B]Cell[/B][/COLOR], DaysOff)
End If
Next Cell
CalcDate = Res
Else
CalcDate = "Enter the first date"
End If
End Function