Sub Transpose()
Dim LargeurTableau As Byte, dep&, lig&, cel As Range, txt$, tablo(), col As Byte, fs%, fa%, tem%
LargeurTableau = 20 'à ajuster éventuellement
dep = 3 'ligne de départ des résultats, à ajuster
lig = dep - 1
Application.ScreenUpdating = False
Cells(dep, "D").Resize(5000, LargeurTableau).ClearContents 'RAZ
For Each cel In Range("B1", [B65536].End(xlUp))
txt = Application.Trim(cel) 'suppression des espaces inutiles
If cel.Offset(, -1) <> "" Or lig < dep Then 'nouvelle série
If lig >= dep Then Cells(lig, "D").Resize(, LargeurTableau) = tablo 'restitution
ReDim tablo(1 To LargeurTableau)
lig = lig + 1
col = 1
End If
fs = InStr(txt, "fs "): fa = InStr(txt, "fa "): tem = InStr(txt, "Témoin")
If col = 1 Then tablo(1) = cel.Offset(, -1)
If fs Then
tablo(3) = Mid(txt, fs, 999)
If fs > 1 Then
col = col + Switch(col = 2, 2, col = 4, 3, True, 1)
tablo(col) = Left(txt, fs - 1)
End If
ElseIf fa Then
tablo(5) = Mid(txt, fa, 999)
If fa > 1 Then
col = col + Switch(col = 2, 2, col = 4, 3, True, 1)
tablo(col) = Left(txt, fa - 1)
End If
ElseIf tem Then
tablo(6) = Mid(txt, tem, 999)
If tem > 1 Then
col = col + Switch(col = 2, 2, col = 4, 3, True, 1)
tablo(col) = Left(txt, tem - 1)
End If
Else
col = col + Switch(col = 2, 2, col = 4, 3, True, 1)
tablo(col) = txt
End If
Next
Cells(lig, "D").Resize(, LargeurTableau) = tablo 'dernière ligne
End Sub