Function Premiers$(t$, n As Byte)
Dim s, i%, j%
t = Application.Trim(Replace(t, Chr(160), "")) 'caractères de code 160 et SUPPRESPACE
s = Split(t)
For i = 0 To UBound(s)
j = j + 1
If Left(s(i), 1) = "(" Then i = i + 1
Premiers = Premiers & " " & s(i)
If j = n Then Exit For
Next
Premiers = LTrim(Premiers)
End Function
Bonjour Guillouche Danielle,
Voyez le fichier .xlsm joint et les formules en K5 et M5 avec cette fonction VBA :
A+VB:Function Premiers$(t$, n As Byte) Dim s, i%, j% t = Application.Trim(Replace(t, Chr(160), "")) 'caractères de code 160 et SUPPRESPACE s = Split(t) For i = 0 To UBound(s) j = j + 1 If Left(s(i), 1) = "(" Then i = i + 1 Premiers = Premiers & " " & s(i) If j = n Then Exit For Next Premiers = LTrim(Premiers) End Function
Bonjour Guillouche Danielle, Salut Job75
Par formules, une pour les heures et une pour les extractions.
Cordialement