resultat d'un combobox

N

Nico74

Guest
bonsoir,
Voici mon Pb
J'ai un tableau de 3 colonnes.
Les données de la 1ere colonne alimentent un combobox.
Je voudrais que lorsque je choisi un nom dans le combobox, la valeur de la 3eme colonne correspondant à cette ligne soit renvoyer dans un label.

En esperant avoir ete assez clair ...
 
L

Ludwig

Guest
bonsoir Nico74,

Pour cet exemple tu as besoin d'un UserForm, d'un ComboBox et d'un Label

Dans ta déclaration de ton UserForm écrit ceci:

Dim NomLBindex As Integer

Private Sub ComboBox1_Change()

NomLBindex = ComboBox1.ListIndex + 1
Range("C" & NomLBindex).Select
Label1.Caption = Range("C" & NomLBindex).Text

End Sub

Private Sub UserForm_Initialize()

Dim L As Integer
Dim Plage As String

L2 = Range("A65536").End(xlUp).Row
Plage2 = Range("A1:A" & L).Address
ComboBox1.RowSource = "Feuil1!" & Plage

End Sub

Et voilà

A bientôt

Ludwig
 
L

Ludwig

Guest
Rectification, copie plutôt cela

Dim NomLBindex As Integer

Private Sub ComboBox1_Change()

NomLBindex = ComboBox1.ListIndex + 1
Range("C" & NomLBindex).Select
Label1.Caption = Range("C" & NomLBindex).Text

End Sub

Private Sub UserForm_Initialize()

Dim L As Integer
Dim Plage As String

L = Range("A65536").End(xlUp).Row
Plage = Range("A1:A" & L).Address
ComboBox1.RowSource = "Feuil1!" & Plage

End Sub
 

Discussions similaires

Réponses
2
Affichages
337

Statistiques des forums

Discussions
312 674
Messages
2 090 790
Membres
104 665
dernier inscrit
ronbt