Bonjour,

Voilà je suis débutant avec VBA sur excel,

J'ai un problème avec la fonction If then else. je vous mets une partie de mon programme.

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
Private Sub CommandButton1_Click()
With Sheets("feuil1").Cells(1, 1)
    .Value = .Value + 1

   i = Sheets("feuil1").Cells(1, 1).Value
   A = Sheets("feuil1").Range("B1:B21")
Set i = .Find(A, LookIn:=xlValues)

If i Is Nothing Then (c'est ici que cela plante)
    Sheets("Symbole").Cells(i, 1).Value = ComboBox1
    Sheets("Symbole").Cells(i, 4).Value = Text1
    Sheets("Symbole").Cells(i, 5).Value = Text2
    Sheets("Symbole").Cells(i, 6).Value = Text3
    Sheets("Symbole").Cells(i, 7).Value = Text4
    Sheets("Symbole").Cells(i, 8).Value = Text5
    Sheets("Symbole").Cells(i, 9).Value = Text6
    Sheets("Symbole").Cells(i, 10).Value = Text7
    Sheets("Symbole").Cells(i, 11).Value = Text8
    Sheets("Symbole").Cells(i, 12).Value = Text9
    Sheets("Symbole").Cells(i, 13).Value = Text10
    Sheets("Symbole").Cells(i, 14).Value = Text11
    Sheets("Symbole").Cells(i, 15).Value = Text12
    Sheets("Symbole").Cells(i, 16).Value = Text13
    Sheets("Symbole").Cells(i, 17).Value = Text14
    Sheets("Symbole").Cells(i, 18).Value = Text15

Else
   Unload Me
   UserForm3.Show
   End If
End With

End Sub
Merci de me dire si vous voyez une erreur,