Vous utilisez un navigateur obsolète. Il se peut que ce site ou d'autres sites Web ne s'affichent pas correctement. Vous devez le mettre à jour ou utiliser un navigateur alternatif.
Boostez vos compétences Excel avec notre communauté !
Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force.
Apprenez, échangez, progressez – et tout ça gratuitement !
👉 Inscrivez-vous maintenant !
Re : Alimenter textbox via combobox sur la feuile 2
Bonjour.
Comme ça:
VB:
Private Sub ComboBox1_Change()
Dim L As Long
L = ComboBox1.ListIndex + 5
With Sheets("Clients")
Me.TextBox1 = .Cells(L, 4).Text 'Adresse
Me.TextBox2 = .Cells(L, 5).Text 'CP
Me.TextBox3 = .Cells(L, 6).Text 'Ville
Me.TextBox4 = .Cells(L, 7).Text 'Tel
Me.TextBox5 = .Cells(L, 8).Text 'Fax
Me.TextBox6 = .Cells(L, 9).Text 'Mobile
Me.TextBox7 = .Cells(L, 10).Text 'Email
End With
End Sub
Re : Alimenter textbox via combobox sur la feuile 2
Bonjour max,
reprends ces codes
Code:
Private Sub UserForm_Initialize()
Dim aa As Variant
aa = Feuil2.Range("C4:C" & Feuil2.Range("C65536").End(xlUp).Row)
ComboBox1.List = aa
End Sub
'Recherche par la combobox
Private Sub ComboBox1_Change()
Dim C As Range
With Sheets("Clients")
Me.TextBox1 = .Cells(ComboBox1.ListIndex + 5, 4).Text 'Adresse
Me.TextBox2 = .Cells(ComboBox1.ListIndex + 5, 5).Text 'CP
Me.TextBox3 = .Cells(ComboBox1.ListIndex + 5, 6).Text 'Ville
Me.TextBox4 = .Cells(ComboBox1.ListIndex + 5, 7).Text 'Tel
Me.TextBox5 = .Cells(ComboBox1.ListIndex + 5, 8).Text 'Fax
Me.TextBox6 = .Cells(ComboBox1.ListIndex + 5, 9).Text 'Mobile
Me.TextBox7 = .Cells(ComboBox1.ListIndex + 5, 10).Text 'Email
End With
End Sub
Re : Alimenter textbox via combobox sur la feuile 2
Re,
je reviens avec une petite modif car dans ton code tu alimentes le combobox à partir de C5 alors que les données commencent en C4
Code:
Private Sub UserForm_Initialize()
Dim aa As Variant
aa = Feuil2.Range("C4:C" & Feuil2.Range("C65536").End(xlUp).Row)
ComboBox1.List = aa
End Sub
'Recherche par la combobox
Private Sub ComboBox1_Change()
Dim C As Range
With Sheets("Clients")
Me.TextBox1 = .Cells(ComboBox1.ListIndex + 4, 4).Text 'Adresse
Me.TextBox2 = .Cells(ComboBox1.ListIndex + 4, 5).Text 'CP
Me.TextBox3 = .Cells(ComboBox1.ListIndex + 4, 6).Text 'Ville
Me.TextBox4 = .Cells(ComboBox1.ListIndex + 4, 7).Text 'Tel
Me.TextBox5 = .Cells(ComboBox1.ListIndex + 4, 8).Text 'Fax
Me.TextBox6 = .Cells(ComboBox1.ListIndex + 4, 9).Text 'Mobile
Me.TextBox7 = .Cells(ComboBox1.ListIndex + 4, 10).Text 'Email
End With
End Sub
- Navigue sans publicité - Accède à Cléa, notre assistante IA experte Excel... et pas que... - Profite de fonctionnalités exclusives Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel. Je deviens Supporter XLD