Titre du sujet : Re: Comment insérer et dupliquer des lignes par Mytå le 29/02/2012 00:11:24
Salut le forum
Bienvenue Bardav comme nouveau membres
Une façon de le faire
Sub InsertAndCopy()
Dim Ligne As Long
For Ligne = 2 To Cells(Rows.Count, "A").End(xlUp).Row * 3 Step 3
Rows(Ligne & ":" & Ligne + 1).Insert Shift:=xlDown
Range(Cells(Ligne - 1, 1), Cells(Ligne - 1, 5)).AutoFill _
Destination:=Range(Cells(Ligne - 1, 1), Cells(Ligne + 1, 5)), _
Type:=xlFillCopy
Next Ligne
End Sub
Ou pour pousser un peu la note
Sub InsertAndCopy()
Dim Ligne As Long
For Ligne = 2 To Cells(Rows.Count, "A").End(xlUp).Row * 3 Step 3
Rows(Ligne & ":" & Ligne + 1).Insert Shift:=xlDown
With Range(Cells(Ligne - 1, 1), Cells(Ligne - 1, 5))
.AutoFill Destination:=.Resize(.Rows.Count + 2, .Columns.Count), Type:=xlFillCopy
End With
Next Ligne
End Sub
Mytå
|