Bonjour,

J'ai créer un formulaire, et je veux que les données entrées seront affichés sur la première ligne vide à partir de la ligne 10 de la colonne A [A10], sauf que des fois ça marche pour moi et des fois il incrémente les valeurs sur la même ligne ou bien il affiche rien.

Deuxième problème, avec l'incrémentation de la valeur date sur la colonne F et G, bloque toujours et empêche l'exécution du macro.

Voici mon code :
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
 Dim i As Long
 
    If MsgBox("Confirmez-vous l’insertion de cette nouvelle commande ?", vbYesNo, "Demande de confirmation d’ajout") = vbYes Then
Unload Me
 
If Worksheets("COMMANDES").Range("A10") = "" Then
        i = 10
        Else
         i = Worksheets("COMMANDES").Range("A65535").End(xlUp).Row + 1
    End If
 
        MsgBox i
 
        Sheets("COMMANDES").Range("A" & i).Value = UserForm3.TextBox1.Value
 
        Sheets("COMMANDES").Range("B" & i).Value = UserForm3.TextBox2.Value
 
        Sheets("COMMANDES").Range("C" & i).Value = UserForm3.ComboBox1.Value
 
        Sheets("COMMANDES").Range("D" & i).Value = UserForm3.ComboBox2.Value
 
        Sheets("COMMANDES").Range("E" & i).Value = UserForm3.TextBox3.Value
 
        Sheets("COMMANDES").Range("F" & i).Value = DateSerial(UserForm3.ComboBox5.Value, UserForm3.ComboBox4.Value, UserForm3.ComboBox3.Value)
 
        Sheets("COMMANDES").Range("G" & i).Value = DateSerial(UserForm3.ComboBox8.Value, UserForm3.ComboBox7.Value, UserForm3.ComboBox6.Value)
 
        Sheets("COMMANDES").Range("J" & i).Value = UserForm3.TextBox4.Value
 
        Sheets("COMMANDES").Range("K" & i).Value = UserForm3.ComboBox9.Value
 
        Sheets("COMMANDES").Range("L" & i).Value = UserForm3.ComboBox10.Value
 
        Sheets("COMMANDES").Range("F" & i).NumberFormat = "dd\/mm\/yyyy"
 
        Sheets("COMMANDES").Range("G" & i).NumberFormat = "dd\/mm\/yyyy"
 
 
    End If
Merci les amis.