Option Explicit
Dim t1 As Date, t2 As Date, jour As Date
Function Minutes(deb As Date, fin As Date) As Long
Dim dat As Long, t As Date, dur As Date
Application.Volatile
t1 = TimeValue("8:0")
t2 = TimeValue("18:0")
jour = t2 - t1
dat = Int(CDec(deb))
t = TimeValue(deb)
dur = PremDer(dat, t)
For dat = dat + 1 To Int(CDec(fin))
If Weekday(dat, 2) < 6 And IsError(Application.Match(dat, [Feries], 0)) Then dur = dur + jour
Next
t = TimeValue(fin)
Minutes = 1440 * (dur - PremDer(dat - 1, t))
End Function
Function PremDer(dat As Long, t As Date) As Date 'traite le 1er et le dernier jour
If Weekday(dat, 2) < 6 And IsError(Application.Match(dat, [Feries], 0)) Then
If t <= t1 Then PremDer = jour
If t > t1 And t < t2 Then PremDer = t2 - t
End If
End Function