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
| Sub Extraction()
Dim i As Long, DerLig As Long, Chevron As Long, Crochet As Long
Dim Cell As String
Application.ScreenUpdating = False
DerLig = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To DerLig
If Cells(i, 1) <> "" Then
If Cells(i, 1).Value Like "*Partie pk*" Then
Cell = Replace(Replace(Cells(i, 1), "[LF]", ""), """", "")
Crochet = InStr(1, Cell, "[", 1)
Cells(i, 2) = Mid(Cell, Crochet, Len(Cell) - Crochet)
Cells(i + 1, 2) = "*L.polygon([*"
i = i + 1
ElseIf Cells(i, 1).Value Like "*Geometrie*" Then
Chevron = InStrRev(Cells(i, 1), ">", -1)
If Len(Cells(i, 1)) > Chevron Then
Cells(i, 2) = Mid(Cells(i, 1), Chevron + 1, Len(Cells(i, 1)) - Chevron)
Else
Chevron = InStr(1, Cells(i, 1), "<", 1)
Cells(i, 2) = Left(Cells(i, 1), Chevron - 1)
End If
ElseIf Left(Cells(i, 1), 1) <> "*" Then
Cells(i, 2) = Cells(i, 1)
Else: Cells(i, 2) = ""
End If
End If
Next
End Sub |