Sub FormatExport()
Dim t, r(1 To 9999, 1 To 7), n&, i&, id, s
With Sheets("Export")
If .FilterMode Then .ShowAllData
t = Sheets("Export").Range("a1").CurrentRegion
End With
With Sheets("Résultat")
.Activate
.Range("a1").CurrentRegion.ClearContents
.Cells(1, 1) = "Numéro": .Cells(1, 2) = "Titre": .Cells(1, 3) = "Type": .Cells(1, 4) = "Identifiant"
.Cells(1, 5) = "Nom": .Cells(1, 6) = "Equipe": .Cells(1, 7) = "Commentaires"
n = 0
For i = 2 To UBound(t)
For Each id In Split(t(i, 4), ";")
n = n + 1
If n = 10000 Then
.Cells(.Rows.Count, "a").End(xlUp).Offset(1).Resize(n, 7) = r
n = 1
End If
r(n, 1) = t(i, 1): r(n, 2) = t(i, 2): r(n, 3) = t(i, 3): r(n, 7) = t(i, 5)
s = Split(id, "-"): r(n, 4) = s(0): r(n, 5) = s(1): r(n, 6) = s(2)
Next id
Next i
If n > 0 Then
.Cells(.Rows.Count, "a").End(xlUp).Offset(1).Resize(n, 7) = r
.Range("a:a").Resize(, 7).EntireColumn.AutoFit
End If
End With
End Sub