Alguiche
XLDnaute Junior
Bonjour à tous,
J'utilise très souvent cette fonction de L.Longre pour déterminer les semaines, mais actuellement je me trouve au Moyen Orient où les weekends sont le vendredi et le samedi et la semaine commence donc le dimanche. Quelqu'un pourrait-il m'adapter cette fonction en conséquence, car je n'ai pas encore compris comment elle fonctionne et les essais que j'ai faits sont pour l'instant infructueux.
Function SemISOs(dat As Date) As Integer '----------------- L.Longre
Dim a As Integer
a = Int((dat - DateSerial(Year(dat), 1, 1) + _
((Weekday(DateSerial(Year(dat), 1, 1)) + 1) _
Mod 7) - 3) / 7) + 1
If a = 0 Then
a = SemISOs(DateSerial(Year(dat) - 1, 12, 31))
ElseIf a = 53 And (Weekday(DateSerial(Year(dat), 12, 31)) - 1) _
Mod 7 <= 3 Then
a = 1
End If
SemISOs = a
End Function
Salutations
Al
J'utilise très souvent cette fonction de L.Longre pour déterminer les semaines, mais actuellement je me trouve au Moyen Orient où les weekends sont le vendredi et le samedi et la semaine commence donc le dimanche. Quelqu'un pourrait-il m'adapter cette fonction en conséquence, car je n'ai pas encore compris comment elle fonctionne et les essais que j'ai faits sont pour l'instant infructueux.
Function SemISOs(dat As Date) As Integer '----------------- L.Longre
Dim a As Integer
a = Int((dat - DateSerial(Year(dat), 1, 1) + _
((Weekday(DateSerial(Year(dat), 1, 1)) + 1) _
Mod 7) - 3) / 7) + 1
If a = 0 Then
a = SemISOs(DateSerial(Year(dat) - 1, 12, 31))
ElseIf a = 53 And (Weekday(DateSerial(Year(dat), 12, 31)) - 1) _
Mod 7 <= 3 Then
a = 1
End If
SemISOs = a
End Function
Salutations
Al