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
|
Sub Heure()
Dim Fe As Worksheet
Dim Plage As Range
Dim Cel As Range
Dim Heures As Integer
Dim Minutes As Integer
Dim Secondes As Integer
'recherche dans toutes les feuilles du classeur
For Each Fe In Worksheets
'plage de recherche en colonne F, G, H, J, M
With Fe
Set Plage = Union(.Range(.[F1], .[F65536].End(xlUp)), _
.Range(.[G1], .[G65536].End(xlUp)), _
.Range(.[H1], .[H65536].End(xlUp)), _
.Range(.[J1], .[J65536].End(xlUp)), _
.Range(.[M1], .[M65536].End(xlUp)))
End With
For Each Cel In Plage
'extrait les heures, minutes et secondes
Heures = Left(Cel, InStr(Cel, "h") - 1)
Minutes = Mid(Cel, InStr(Cel, " ") + 1, InStr(Cel, "mn") - InStr(Cel, " ") - 1)
Secondes = Mid(Cel, InStrRev(Cel, " ") + 1, InStr(Cel, "s") - InStrRev(Cel, " ") - 1)
'formate et inscrit dans la cellule
Cel = Format(Heures, "00h") & Format(Minutes, "00m") & Format(Secondes, "00s")
Next Cel
Next Fe
End Sub |
Partager