Problème combobox

HanaeCh Messages postés 1 Date d'inscription   Statut Membre Dernière intervention   -  
danielc0 Messages postés 1858 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour tout le monde,

Je suis débutante en VBA, et je dois créer une application avec plusieurs fonctions, et là je plante au niveau d'un truc.

Normalement j'ai une BDD qui contient différents articles avec leurs composants, j'ai créé un userform qui facilitera le recherche d'un article et la caractéristique de recherche c'est le nom de l'article, j'ai donc affecté les différents noms dans un combobox et ce que je voudrai faire c'est une fois que je selectionne un nom, sa colonne doit se colorier automatiquement.

J'ai donc essayé avec ce code mais ça marche pas, est ce que qlq1 pourrait m'aider ?


Private Sub ComboBox_articles_Change()

index = Rech_art.ComboBox_articles.ListIndex
Sheets("Nomenclature_articles").Select
For Each cellule In Range("E10:ES10")

If cellule.Value = ComboBox_articles.Value Then Range(index).Interior.ColorIndex = RGB(255, 0, 0)
End Sub

1 réponse

danielc0 Messages postés 1858 Date d'inscription   Statut Membre Dernière intervention   231
 
Bonjour,

Cette ligne est incompréhensible :

Index = Rech_art.ComboBox_articles.ListIndex


Qu'est-ce que "Rech_art.ComboBox_articles" ? Un autre combobox ? En tout cas, "ListIndex" renvoie une valeur numérique. Donc, à quoi : "Range(index)" correspond-il ?

Daniel
0