Bonsoir le forum,
Dans le code suivant j'ai l'erreur suivante : Erreur d'exécution 475, Cette clé est déjà associée à un élément de cette collection. ??? Pourtant le tout fonctionnait très bien il y a quelques jours et je n'ai rien modifié pour obtenir cette erreur.
Private Sub UserForm_Initialize()
Dim data As Collection
Dim L As Long
Dim cc As Range
Dim i As Integer
Dim f As Integer
ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear
ComboBox4.Clear
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox5.Clear
ListBox6.Clear
ListBox11.Clear
ListBox8.Clear
CheckBox2.Value = False
CheckBox9.Value = False
CheckBox11.Value = False
For f = 1 To 6
Controls("OptionButton" & f).Value = False
Next f
For i = 1 To 12
If Controls("TextBox" & i) <= 0 Or Controls("TextBox" & i) = "" Then
Controls("TextBox" & i).Value = ""
Controls("TextBox" & i).BackColor = &H8000000F
End If
Next i
Set myr1i = Range("Feuil1!A2:a" & [65536:65536].End(xlUp).Row)
Do While th1i.Count > 0
th1i.Remove 1
Loop
On Error Resume Next
For Each cc In myr1i.Cells
th1i.Add cc, CStr(cc) 'ici le code s'arrête
Next cc
ComboBox1.Clear
For L = 1 To th1i.Count
ComboBox1.AddItem th1i(L)
Next L
Set data = New Collection
On Error Resume Next
For L = 1 To UBound(tablo, 1)
If tablo(L, 1) <> "" Then
data.Add tablo(L, 1), CStr(tablo(L, 1))
End If
Next L
On Error GoTo 0
For L = 1 To data.Count
ComboBox1.AddItem data.Item(L)
Next L
Set data = Nothing
End Sub
L'erreur serait à quoi ?
Merci
Dans le code suivant j'ai l'erreur suivante : Erreur d'exécution 475, Cette clé est déjà associée à un élément de cette collection. ??? Pourtant le tout fonctionnait très bien il y a quelques jours et je n'ai rien modifié pour obtenir cette erreur.
Private Sub UserForm_Initialize()
Dim data As Collection
Dim L As Long
Dim cc As Range
Dim i As Integer
Dim f As Integer
ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear
ComboBox4.Clear
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox5.Clear
ListBox6.Clear
ListBox11.Clear
ListBox8.Clear
CheckBox2.Value = False
CheckBox9.Value = False
CheckBox11.Value = False
For f = 1 To 6
Controls("OptionButton" & f).Value = False
Next f
For i = 1 To 12
If Controls("TextBox" & i) <= 0 Or Controls("TextBox" & i) = "" Then
Controls("TextBox" & i).Value = ""
Controls("TextBox" & i).BackColor = &H8000000F
End If
Next i
Set myr1i = Range("Feuil1!A2:a" & [65536:65536].End(xlUp).Row)
Do While th1i.Count > 0
th1i.Remove 1
Loop
On Error Resume Next
For Each cc In myr1i.Cells
th1i.Add cc, CStr(cc) 'ici le code s'arrête
Next cc
ComboBox1.Clear
For L = 1 To th1i.Count
ComboBox1.AddItem th1i(L)
Next L
Set data = New Collection
On Error Resume Next
For L = 1 To UBound(tablo, 1)
If tablo(L, 1) <> "" Then
data.Add tablo(L, 1), CStr(tablo(L, 1))
End If
Next L
On Error GoTo 0
For L = 1 To data.Count
ComboBox1.AddItem data.Item(L)
Next L
Set data = Nothing
End Sub
L'erreur serait à quoi ?
Merci