fixing code populate data in multiple textboxes based on multiple comboboxes

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello

I need help about find way to populate data in textbox based on select from combo box it works only combobox1 & textbox1
what I want the rests of combobox when I select item then populate in textbox



VBA Code:
Private Sub ComboBox1_Change()
 Me.TextBox1.Value = Sheets("Sheet1").Range("e" & Me.ComboBox1.ListIndex + 2).Value
 Me.TextBox2.Value = Sheets("Sheet1").Range("e" & Me.ComboBox2.ListIndex + 2).Value
 Me.TextBox3.Value = Sheets("Sheet1").Range("e" & Me.ComboBox3.ListIndex + 2).Value
 Me.TextBox4.Value = Sheets("Sheet1").Range("e" & Me.ComboBox4.ListIndex + 2).Value
End Sub


Private Sub UserForm_Initialize()
With Sheets("Sheet1")
      Me.ComboBox1.List = .Range("b2:b" & .Range("A" & Rows.Count).End(xlUp).Row).Value
       Me.ComboBox2.List = .Range("b2:b" & .Range("A" & Rows.Count).End(xlUp).Row).Value
       Me.ComboBox3.List = .Range("b2:b" & .Range("A" & Rows.Count).End(xlUp).Row).Value
      Me.ComboBox4.List = .Range("b2:b" & .Range("A" & Rows.Count).End(xlUp).Row).Value
   End With
End Sub
thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Either put your Combo change event code into a command button, or just populate each textbox from the relevant combo change event.
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top