1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub ioi()
Dim Tabl()
Dim i As Long, j As Long
' on prend la colonne A et B de Feuil1
With Worksheets("Feuil1")
Tabl = .Range(.Cells(1, 1), .Cells(.Rows.Count, 2).End(xlUp)).Value
End With
' pour chaque valeur de la colonne A
For i = LBound(Tabl, 1) To UBound(Tabl, 1)
' pour un nombre de fois égale au nombre qui est en colonne B
For j = 1 To Tabl(i, 2)
With Worksheets("Feuil2")
' on écrit la valeur dans la Feuil2, en colonne A
.Cells(.Rows.Count, 1).End(xlUp)(2).Value = Tabl(i, 1)
End With
Next j
Next i
End Sub |
Partager