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
| Dim DEP
DEP = 1
Dim POS1
Dim POS2
Dim POS3
SEP = " "' si separateur espace
ETUDE = Cells(1, 1)'cellule etudiée
DEPART:
For CHERCH = DEP To Len(ETUDE) + 1
If Mid(ETUDE, CHERCH, 1) = SEP And POS1 = "" Then
POS1 = CHERCH
DEP = CHERCH + 1
GoTo DEPART
End If
If Mid(ETUDE, CHERCH, 1) = SEP And POS2 = "" Then
POS2 = CHERCH
DEP = CHERCH + 1
GoTo DEPART
End If
If Mid(ETUDE, CHERCH, 1) = SEP And POS3 = "" Then
POS3 = CHERCH
DEP = CHERCH + 1
GoTo DEPART
End If
Next CHERCH
'cellules d'arrivées
Cells(2, 1) = Mid(ETUDE, 1, POS1)
Cells(3, 1) = Mid(ETUDE, POS1 + 1, POS2 - POS1)
Cells(4, 1) = Mid(ETUDE, POS2 + 1, POS3 - POS2)
Cells(5, 1) = Mid(ETUDE, POS3 + 1, Len(ETUDE) - POS3 + 1) |
Partager