A la ligne suivante automatique

Bonjour,

Comment modifier ce code pour que ca mette automatiquement a ligne suivant ( car la ca va toujours sur la même ligne )

Sub RemplirLaListeACommander()

Dim Cell As Range

Dim LigneDestination As Integer

Sheets("A commander").Range("A4:J1000") = ""

LigneDestination = 4

With Sheets("Stocks")

For Each Cell In .Range("A4:A" & .Range("A1000").End(xlUp).Row)

If Cell.Offset(0, 9) = "A commander" Then

.Range(Cell, Cell.Offset(0, 9)).Copy Destination:=Sheets("A commander").Range("A" & LigneDestination)

End If

Next

End With

End Sub

Bonjour Piloupil, bonjour le forum

Juste que tu as oublié d'incrémenter la LigneDestination ! Ton code corrigé :

Sub RemplirLaListeACommander()
Dim Cell As Range
Dim LigneDestination As Integer

Sheets("A commander").Range("A4:J1000") = ""
LigneDestination = 4
With Sheets("Stocks")
    For Each Cell In .Range("A4:A" & .Range("A1000").End(xlUp).Row)
        If Cell.Offset(0, 9) = "A commander" Then
            .Range(Cell, Cell.Offset(0, 9)).Copy Destination:=Sheets("A commander").Range("A" & LigneDestination)
            LigneDestination = LigneDestination + 1
        End If
    Next
End With
End Sub

Super merci

Rechercher des sujets similaires à "ligne suivante automatique"