Application.ScreenUpdating = False
ActiveSheet.Unprotect
Dim r As Range, x$
Set r = Intersect(Target, [t6:x7,t11:x12,t16:x17,t21:x30,t33:x34])
''Set r = Intersect(Target, Me.UsedRange)
If r Is Nothing Then Exit Sub
Application.EnableEvents = False
r.NumberFormat = "General"
For Each r In r 'si entrées multiples (copier-coller)
If r Like "#" Or r Like "##" Or r Like "###" Or r Like "####" Then
x = Format(r, "0000")
r = Left(x, 2) & ":" & Mid(x, 3) ' ici j'ai remplacé le : par h mais ce n'est plus du format heure
r.NumberFormat = "hh:mm" 'j'ai essayé ici hh"h"mm mais çà fonctionne pas
End If
Next
ActiveSheet.Protect
Application.EnableEvents = True
Application.ScreenUpdating = True