Private Sub Analyser_Click()
Dim b, a, x$, i%, pos%
b = Array("Nom", "Prénom", "Adresse email") 'liste à adapter
ReDim a(UBound(b))
x = Application.Trim(Replace(Replace(TextBox1, vbCrLf, ""), vbTab, ""))
For i = 0 To UBound(a)
a(i) = InStr(x, b(i)) 'position du libellé
Next
tri a, b, 0, UBound(a) 'tri avec 2 tableaux
For i = 0 To UBound(a) - 1
pos = a(i) + Len(b(i))
a(i) = Trim(Mid(x, pos, a(i + 1) - pos))
Next
pos = a(i) + Len(b(i))
a(i) = Trim(Mid(x, pos, Len(x) + 1 - pos))
'---Vérification---
[A1:C1] = b 'libellés
[A2:C2] = a 'valeurs
End Sub
Sub tri(a, b, gauc, droi) ' Quick sort
Dim ref, g, d, temp
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
If g <= d Then
temp = a(g): a(g) = a(d): a(d) = temp
temp = b(g): b(g) = b(d): b(d) = temp
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call tri(a, b, g, droi)
If gauc < d Then Call tri(a, b, gauc, d)
End Sub