Problème code macros

Bonjour j'ai un problème en executant le code ci dessous sur le fichier ci joint.débogage au niveau de la ligne en gras !

Sub RecopierLigne()

Dim Ligne As Integer

Dim Nbre As Integer

For Ligne = [a1].End(xlDown).Row To 1 Step -1

Nbre = Cells(Ligne, 3) - Cells(Ligne, 2)

If Nbre > 0 Then

Rows(Ligne + 1 & ":" & Ligne + Nbre).Insert

Range(Cells(Ligne, 1), Cells(Ligne, 5)).AutoFill _

Destination:=Range(Cells(Ligne, 1), Cells(Ligne + Nbre, 5)), Type:=xlFillCopy

Cells(Ligne, 2).AutoFill _

Destination:=Range(Cells(Ligne, 2), Cells(Ligne + Nbre, 2))

End If

Next Ligne

Merci

https://www.excel-pratique.com/~files/doc2/STvxBClasseur2.xls

Bonjour,

çà bogue quand vide en colonne "C",

j'ai donc ajouté un contrôle pour çà

Sub RecopierLigne()
Dim Ligne As Integer
Dim Nbre As Integer

For Ligne = [a1].End(xlDown).Row To 1 Step -1
    If Cells(Ligne, 3) <> "" Then
        Nbre = Cells(Ligne, 3) - Cells(Ligne, 2)
    If Nbre > 0 Then
        Rows(Ligne + 1 & ":" & Ligne + Nbre).Insert
        Range(Cells(Ligne, 1), Cells(Ligne, 5)).AutoFill _
        Destination:=Range(Cells(Ligne, 1), Cells(Ligne + Nbre, 5)), Type:=xlFillCopy
        Cells(Ligne, 2).AutoFill _
        Destination:=Range(Cells(Ligne, 2), Cells(Ligne + Nbre, 2))
    End If
    End If
Next Ligne
End Sub

Attention, çà t'emmène à la ligne 7200

Amicalement

Claude.

Merci claude ! mais elle ne fait plus mon recopie de ligne !!!!!

re,

dans le fichier que tu as joint, çà marche sans problème,

744 lignes devient 7292 lignes

Autant pour moi ! c'est nickel merci

Rechercher des sujets similaires à "probleme code macros"