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
| Sub Isoler_les_Elements()
Dim Prem_2Pts As Long, Deux_2Pts As Long, Accol_Ouv As Long, Accol_Fer As Long
Dim Prem_Mot As String, Deux_Mot As String, Mot_Complet As String, Version As String, Reste As String
Application.ScreenUpdating = False
'Isoler BU et MB pour en faire un entête
Prem_2Pts = InStr(1, Cells(1, 1), ":", 1)
Prem_Mot = Left(Cells(1, 1), Prem_2Pts - 1)
Accol_Ouv = InStr(1, Cells(1, 1), "{", 1)
Deux_2Pts = InStr(Accol_Ouv, Cells(1, 1), ":", 1)
Deux_Mot = Mid(Cells(1, 1), Accol_Ouv + 2, Deux_2Pts - Accol_Ouv - 2)
'Mot_Complet = Prem_Mot & " " & Deux_Mot
Version = Mid(Cells(1, 1), Prem_2Pts + 1, Accol_Ouv - 2 - Prem_2Pts)
'Isoler le reste du texte
Accol_Fer = InStr(1, Cells(1, 1), "}", 1)
Reste = ":" & Mid(Cells(1, 1), Deux_2Pts + 1, Len(Cells(1, 1)) - Deux_2Pts - 2) & ":"
'Suppression du deuxième mot" MB" dans le reste
Reste = Replace(Reste, " " & Deux_Mot, "")
'Restitution
Valeur = Split(Reste, ":")
ReDim Restit(UBound(Valeur)) As String
For i = 1 To UBound(Valeur) - 1
Restit(i) = Valeur(i)
Next
Range(Cells(2, "A"), Cells(UBound(Valeur) + 1, "A")) = Version
Range(Cells(2, "B"), Cells(UBound(Valeur) + 1, "B")) = Application.WorksheetFunction.Transpose(Restit)
Range(Cells(2, "A"), Cells(2, "B")) = Array(Prem_Mot, Deux_Mot)
End Sub |
Partager