Bonjour,

J'ai des informations sur une feuille sous forme de Tableau que j'aimerais copier et coller la ligne quand la dénrnière colonne de cette ligne est bien remplie.

Normalement mon fichier fonctionnais correctement jusqu'à ce que je rajoute des lignes sur la feuil initial (j'ai l'erreur sur la ligne 27)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Sub Btn_CreationCommande()
 
'MessageBox de confirmation de création de commande
Dim Var_Answer_order As Integer
Var_Answer_order = MsgBox("Souhaitez-vous créer un bon de commande?", vbYesNo + vbQuestion, "Création de bon de commande")
'Start IF
If Var_Answer_order = vbNo Then _
    'do nothing
Else
 
    'Affichage feuille "COMMANDE"
    Sheets("COMMANDE").Visible = True
 
    'Suppression des données de la commande
    Sheets("COMMANDE").Rows("12:10000").Delete
 
    'Mettre les infos générales de la commande
    Sheets("COMMANDE").Range("B6").Value = Date
    Sheets("COMMANDE").Range("B8").Value = Sheets("Info").Range("A22").Value
    Sheets("COMMANDE").Range("E6").Value = Sheets("Info").Range("A10").Value
 
    'Boucle for n=1 à n=NbRow pour la gamme ALJADIDPRO
    Dim NbRow As Integer
        NbRow = Range("Table_ALJADIDPRO").Rows.Count
 
    Dim LastRow As Integer
        LastRow = Range("Table_COMMANDE").Rows.Count
        'Mettre "Produits ALJADID PRO" en en-tete de produits
        Range("table_COMMANDE").Cells(LastRow, 1) = "Produits ALJADID PRO"
             Range("table_COMMANDE").Cells(LastRow, 1).Font.Bold = True
 
    Dim i As Integer
    For i = 1 To NbRow 'or Range("Table_ALJADIDPRO").Cells(i, 6).Value
        If Range("Table_ALJADIDPRO").Cells(i, 6).Value Or Range("Table_ALJADIDPRO").Cells(i, 7).Value <> Empty Then _
 
                If Range("table_COMMANDE").Cells(LastRow, 1).Value <> Empty Then _
                    LastRow = LastRow + 1
                    Range("table_COMMANDE").Cells(LastRow, 1).Value = Range("Table_ALJADIDPRO").Cells(i, 1).Value
                    Range("table_COMMANDE").Cells(LastRow, 2).Value = Range("Table_ALJADIDPRO").Cells(i, 2).Value
                    Range("table_COMMANDE").Cells(LastRow, 3).Value = Range("Table_ALJADIDPRO").Cells(i, 6).Value
                    Range("table_COMMANDE").Cells(LastRow, 4).Value = Range("Table_ALJADIDPRO").Cells(i, 7).Value
                        Range("table_COMMANDE").Cells(LastRow, 1).Borders.Weight = xlThin
                        Range("table_COMMANDE").Cells(LastRow, 2).Borders.Weight = xlThin
                        Range("table_COMMANDE").Cells(LastRow, 3).Borders.Weight = xlThin
                        Range("table_COMMANDE").Cells(LastRow, 3).HorizontalAlignment = xlCenter
                        Range("table_COMMANDE").Cells(LastRow, 4).Borders.Weight = xlThin
                        Range("table_COMMANDE").Cells(LastRow, 4).NumberFormat = "0"" kg"""
                        Range("table_COMMANDE").Cells(LastRow, 5).Borders.Weight = xlThin
                End If
    Next
Merci pour votre retour.