1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| Sub HEUREPC()
Range("C2:G2").Select
Selection.ClearContents
Dim valeur, txt, txtD, txtS, txtM1, txtM2, txtH1, txtH2, NBR As String
valeur = Range("B2")
NBR = Len(Range("B2"))
Select Case NBR
Case Is = 3
txtS = Left(valeur, 2)
Range("E2") = txtS
txtD = Mid(valeur, 3, 1)
Range("F2") = txtD
txt = txtS & "," & txtD
Range("G2") = txt
Case Is = 4
txtM1 = Left(valeur, 1)
Range("D2") = txtM1
txtS = Mid(valeur, 2, 2)
Range("E2") = txtS
txtD = Mid(valeur, 4, 1)
Range("F2") = txtD
txt = txtM1 & ":" & txtS & "," & txtD
Range("G2") = txt
Case Is = 5
txtM2 = Left(valeur, 2)
Range("D2") = txtM2
txtS = Mid(valeur, 3, 2)
Range("E2") = txtS
txtD = Mid(valeur, 5, 1)
Range("F2") = txtD
txt = txtM2 & ":" & txtS & "," & txtD
Range("G2") = txt
Case Is = 6
txtH1 = Left(valeur, 1)
Range("C2") = txtH1
txtM2 = Mid(valeur, 2, 2)
Range("D2") = txtM2
txtS = Mid(valeur, 4, 2)
Range("E2") = txtS
txtD = Mid(valeur, 6, 1)
Range("F2") = txtD
txt = txtH1 & ":" & txtM2 & ":" & txtS & "," & txtD
Range("G2") = txt
Case Is = 7
txtH2 = Left(valeur, 2)
Range("C2") = txtH2
txtM2 = Mid(valeur, 3, 2)
Range("D2") = txtM2
txtS = Mid(valeur, 5, 2)
Range("E2") = txtS
txtD = Mid(valeur, 7, 1)
Range("F2") = txtD
txt = txtH2 & ":" & txtM2 & ":" & txtS & "," & txtD
Range("G2") = txt
Case Else
MsgBox "ERREUR"
End Select
Range("A1").Select
End Sub |
Partager