Bonjour,
autres possibilités un peu plus au niveau d'un débutant :
• copie ligne par ligne :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub Demo1()
Dim SP$()
Application.ScreenUpdating = False
Feuil2.UsedRange.Clear
D& = 2
With Feuil1.UsedRange.Rows
.Item(1).Copy Feuil2.Cells(1)
For R& = 2 To .Count
SP = Split(.Cells(R, 2).Value, "/")
L& = 1 + UBound(SP)
Feuil2.Cells(D, 1).Resize(L).Value = .Cells(R, 1).Value
Feuil2.Cells(D, 2).Resize(L).Value = Application.Transpose(SP)
D = D + L
Next
End With
Feuil2.Activate
Application.ScreenUpdating = True
End Sub |
• Copie globale puis insertion :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub Demo2()
Dim SP$()
Application.ScreenUpdating = False
With Feuil2
.UsedRange.Clear
Feuil1.UsedRange.Copy .Cells(1)
For R& = .UsedRange.Rows.Count To 2 Step -1
SP = Split(.Cells(R, 2).Value, "/")
If UBound(SP) > 0 Then
.Rows(R + 1).Resize(UBound(SP)).Insert
.Cells(R, 1).Copy .Cells(R + 1, 1).Resize(UBound(SP))
.Cells(R, 2).Resize(1 + UBound(SP)).Value = Application.Transpose(SP)
End If
Next
.Activate
End With
Application.ScreenUpdating = True
End Sub |
Rappel de l'usage de ce forum :
______________________________________________________________________________________________________
Merci de cliquer sur
pour chaque message ayant aidé puis sur
pour clore cette discussion …
______________________________________________________________________________________________________
Je suis Paris, …
Partager