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 31 32 33 34
| Dim SP_C$()
Dim i As Integer, derlig As Integer, lig As Integer, nombre As Integer
Dim plage As Range
Dim cel As Object
derlig = Sheets(1).Range("A65536").End(xlUp).Row
Set plage = Range("A2:A" & derlig)
lig = 5
For Each cel In plage
SP_A = Split(Cells(cel.Row, 5), ";")
SP_B = Split(Cells(cel.Row, 6), ";")
SP_C = Split(Cells(cel.Row, 7), ";")
'nombre = Application.Max(UBound(SP_A, 1), UBound(SP_B, 1), UBound(SP_C, 1))
'nombre = Application.Sum(UBound(SP_A, 1), UBound(SP_B, 1), UBound(SP_C, 1))
nombre = UBound(SP_A, 1) + UBound(SP_B, 1) + UBound(SP_C, 1) + 2
For i = 0 To nombre
On Error Resume Next
Rows(cel.Row).Copy Rows(derlig + lig)
Range(Cells(derlig + lig, 5), Cells(derlig + lig, 7)).ClearContents
Cells(derlig + lig, 5) = SP_A(i)
If (i >= UBound(SP_A, 1) + 1) And (i < UBound(SP_A, 1) + UBound(SP_B, 1) + 2) Then
Range(Cells(derlig + lig, 5), Cells(derlig + lig, 7)).ClearContents
aux1 = i - (UBound(SP_A, 1) + 1)
Cells(derlig + lig, 6) = SP_B(aux1)
End If
If (i >= UBound(SP_A, 1) + UBound(SP_B, 1) + 2) Then
Range(Cells(derlig + lig, 5), Cells(derlig + lig, 6)).ClearContents
aux2 = i - (UBound(SP_A, 1) + UBound(SP_B, 1) + 2)
Cells(derlig + lig, 7) = SP_C(aux2)
End If
lig = lig + 1
Next i
Next cel |
Partager