merci ThauThème ,
ça marche bien sur mon tableau en exemple , code propre et rapide.
cependant, adapté à mon tableau de 25000 lignes et 35 colonnes, j'ai une erreur d’exécution 6 - dépassement de capacité une idée ?
dans l'attente, je garde mon code pas propre
Option Explicit
Dim Ws As Worksheet
Dim NbLignes As Integer
Private Sub ComboBox1_Change()
Dim j As Long
Dim kol As New Collection
MsgBox NbLignes
For j = CLng(1) To NbLignes
On Error Resume Next
If Ws.Range("F" & j).Value = Me.ComboBox1.Value Then kol.Add Ws.Range("E" & j).Value, Range("E" & j).Value
Next j
Me.ComboBox2.Clear
For j = 1 To kol.Count
Me.ComboBox2.AddItem kol(j)
Next j
End Sub
Private Sub ComboBox2_Change()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
Dim v, e
Dim i As Integer
Set Ws = Worksheets("data")
Range("F:F") = [index(Upper(F:F),)]
NbLignes = Ws.Cells(Ws.Rows.Count, 1).End(xlUp).Row
With Sheets("data").Range("F:F")
v = .Value
End With
With CreateObject("scripting.dictionary")
.comparemode = 1
For Each e In v
If Not .exists(e) Then .Add e, Nothing
Next
If .Count Then Me.ComboBox1.List = Application.Transpose(.keys)
End With
End Sub
petite question subsidiaire :
j'aimerai que les valeurs de la colonne X qui correspondent(plusieurs cellules) au choix de ma combobox2 s'affiche dans une textbox.
encore merci (de plus , j'ai découvert la fonction currentregion