Cacher un indice dans une combobox

ssassam

XLDnaute Occasionnel
Bonjour tout le monde,

Svp j'ai une combobox2 qui affiche la liste des N° client d'une feuil Excel.

j'ai certain N° de client qui contiens le mot ANNL (Exp:12452.ANNL)

Svp comment ne pas afficher tout les N° cui contien le mot.ANNL

Merci beaucoup
 

Pierrot93

XLDnaute Barbatruc
Re : Cacher un indice dans une combobox

Bonjour,

A voir comment ta combo est alimentée.... utilise la méthode "AddItem" en effectuant un test à l'aide de l'opérateur "like", exemple ci-dessous à adapter à ton projet :
Code:
If Not Cells(1, 1) Like "*ANNL*" Then ListBox1.AddItem
bonne journée
@+
 

ssassam

XLDnaute Occasionnel
Re : Cacher un indice dans une combobox

Merci Pierrot93

Voila comment est alimenté mon code:

With Sheets("xxxx")

For i = 2 To .Range("a65536").End(xlUp).Row
ComboBox1.AddItem
ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 4)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
Next i


Stp comment j’intègre ta proposition a mon code
 

Pierrot93

XLDnaute Barbatruc
Re : Cacher un indice dans une combobox

Re,

insère le test dans ta boucle :
Code:
For i = 2 To .Range("a65536").End(xlUp).Row
    If .Cells(i, 4) Like "*ANNL*" Then
        ComboBox1.AddItem
        ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 4)
        ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
    End If
Next i
 

Discussions similaires

Réponses
10
Affichages
379

Statistiques des forums

Discussions
312 215
Messages
2 086 321
Membres
103 178
dernier inscrit
BERSEB50