Populate List Box Text Box with Excel Data Using VBA

How to Populate Listbox and Textboxes with Excel data using VBA
A question asked by one of our website visitors:
How to populate a list box and text boxes using data from an Excel worksheet using VBA. I have a user form with an optionbutton and 2 text boxes.
(1) Once I click on the option button ‘fans’ I wish that my list box gets populated with data from the ‘fans’ column.
(3) When I select a model I wish that the diameter of the fans and their wattage appears in the corresponding text boxes.
How can this be done quickly and easily?

Code for the optionbutton:
Private Sub OptionButton1_Change()
Me.ListBox1.RowSource = “A2: A5”
End Sub

Code for the Listbox:
Private Sub ListBox1_Change()
TextBox1.Value = Application.VLookup(Me.ListBox1, Sheets(“Sheet1”).Range(“A:C”), 2, False)

TextBox2.Value = Application.VLookup(Me.ListBox1, Sheets(“Sheet1”).Range(“A:C”), 3, False)
End Sub

Code for the commandbutton:
Private Sub CommandButton1_Click()
End Sub

Watch the video (21 MB) below to see the solution:

2 thoughts on “Populate List Box Text Box with Excel Data Using VBA

  1. Pingback: Best Training on Advanced Excel and VBA in Bangalore | jaseemblog

  2. Vikash Raj

    Hello sir, firstly I would like to say thank-you for providing such a helpful videos.

    Sir I’m facing problem in filtering in list box. As I’ve a spreadsheet containing receipt no. school id and some more details about fee details. So I want to filter all the details in list box having same school id .
    so please help me. I’ve tried but can’t find.


Leave a Reply

Your email address will not be published. Required fields are marked *