Bonjour,
J"essaye d'adapter 2 codes à mes besoins mais voila il me met que la méthode range à échoué, à votre avis d'ou proviendrait le probleme.
Merci
Private Sub BtnOK_Click()
Dim crit1 As Variant
Dim crit2 As Variant
Dim crit3 As Variant
Dim temp As Variant
For ind = 1 To 3
If Me("Label" & ind).Caption = "Critère " & ind Then
Me("Label" & ind).Caption = Me.ComboBox1.Value
NomSht = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 2)
Set Sht = Sheets(NomSht)
Col = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 1)
'méthode Dictionary issue du site de Jacques BOISGONTIER : Formation Excel VBA JB
dl = Sht.Cells(Application.Rows.Count, 1).End(xlUp).Row
Set crit1 = CreateObject("Scripting.Dictionary")
For Each cel In Sht.Range(Col & dl) 'boucle sur toutes les cellules éditées de la Colonne
crit1.Item(cel.Value) = cel.Value
Next cel
temp = crit1.items
Call tri(temp, LBound(temp), UBound(temp))
Me.ComboBox2.List = temp
End If
Next ind
End Sub
merci @+
J"essaye d'adapter 2 codes à mes besoins mais voila il me met que la méthode range à échoué, à votre avis d'ou proviendrait le probleme.
Merci
Private Sub BtnOK_Click()
Dim crit1 As Variant
Dim crit2 As Variant
Dim crit3 As Variant
Dim temp As Variant
For ind = 1 To 3
If Me("Label" & ind).Caption = "Critère " & ind Then
Me("Label" & ind).Caption = Me.ComboBox1.Value
NomSht = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 2)
Set Sht = Sheets(NomSht)
Col = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 1)
'méthode Dictionary issue du site de Jacques BOISGONTIER : Formation Excel VBA JB
dl = Sht.Cells(Application.Rows.Count, 1).End(xlUp).Row
Set crit1 = CreateObject("Scripting.Dictionary")
For Each cel In Sht.Range(Col & dl) 'boucle sur toutes les cellules éditées de la Colonne
crit1.Item(cel.Value) = cel.Value
Next cel
temp = crit1.items
Call tri(temp, LBound(temp), UBound(temp))
Me.ComboBox2.List = temp
End If
Next ind
End Sub
merci @+