Bonjour,
Une autre proposition pour le fun.
Cdlt.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing Then
Application.EnableEvents = False
x = MilitaryToTime(Target.Value)
With Target
.Value = x
.NumberFormat = "[hh]:mm"
End With
Application.EnableEvents = True
End If
End Sub
'Military To Time
'This function converts military time, supplied as an integer, to a standard serial time number.
'For example, it converts 1130 to 11:30, and 1650 to 16:50.
Public Function MilitaryToTime(T1 As Integer) '
' Input T1: 24-hour time as integer,e.g., 1130=11:30, 1650=16:50
' Output, time as serial time e.g, 0.5 for noon.'
Dim TT1 As Double
TT1 = Int(T1 / 100) + (((T1 / 100) - Int(T1 / 100)) / 0.6) '23.50
TT1 = TT1 / 24
MilitaryToTime = TT1
End Function