Erreur d'exécution 13, incompatibilité de typ

Bonjour,
J'ai un probléme, car a priori j'ai écrit la meme chose sur deux userforms différents, il y en a un qui marche et l'autre erreur d'éxécution 13, incompatibilté de type. ESt ce que il y a quelque que je pourrai vérifier. merci

Celui la marche:
Private Sub UserForm_Activate()
TextBox1.Enabled = False
i = 3

If TextBox1.Value = "SIL9" Then
Do While Worksheets("Cu").Cells(3, i) <> ""
If IsNumeric(Worksheets("Cu").Cells(3, i).Value) Then
ListBox1.AddItem Worksheets("Cu").Cells(2, i).Value
End If
i = i + 1
Loop
End If
End Sub

Celui la marche pas:
Private Sub UserForm_Activate()
TextBox1.Enabled = False

i = 4

If TextBox1.Value = "SIL9" Then
Do While Worksheets("granulo").Cells(3, i) <> ""
If IsNumeric(Worksheets("granulo").Cells(3, i).Value) Then
ListBox1.AddItem Worksheets("granulo").Cells(2, i).Value
End If
i = i + 1
Loop
End If
End Sub

3 réponses

  • Votes
  • Date
  • Date décroissante
  1. As-tu testé au pas à pas en vérifiant ce que contient tes variables ?

    De plus, on ne va pas éplucher ligne par ligne ton code, alors si tu nous mettais la ligne qui cloche, tout le monde gagnerai du temps.
    1. Bonjour,
      Private Sub UserForm_Activate()
      TextBox1.Enabled = False

      i = 4

      If TextBox1.Value = "SIL9" Then
      Do While Worksheets("granulo").Cells(3, i) <> "" ca s'arrete là
      If IsNumeric(Worksheets("granulo").Cells(3, i).Value) Then
      ListBox1.AddItem Worksheets("granulo").Cells(2, i).Value
      End If
      i = i + 1
      Loop
      End If
      End Sub
      1. Merci, bien que ça fasse double emploi ...

        Néanmoins, dans un élan de générosité de ta part, peux-tu dire précisément sur quelle ligne l'erreur 13 apparaît ? Désolé, j'étais nul en science divinatoire ^^

        ;o)
    2. l'erreur 13 apparait sur
      Do While Worksheets("granulo").Cells(3, i) <> ""