|
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
End
Sub
Watch the video (21 MB) below
to see the solution:
More Tips (Solutions):
How do I view and edit Microsoft Excel files on an
iPad?
Inventory Soluton
How to rename and color worksheet tabs
Copy Worksheet Quickly
Criteria Range
Animations in Microsoft Excel
Create two charts at once
How to avoid errors while working in Excel
How to benefit from
Microsoft Excel Templates
How to use Microsoft Excel 2007 with Word 2007 -
create mail
merge labels
Landscape Oriented Worksheet Template
How to-make a worksheet fit a printed page
How to make
your charts more impressive
Perpetual
Calendar from 1900 to 9999
How to create your own custom add-in
How
to clear conditional formattng in Excel worksheets
How to speed up data entry of decimal numbers
How to change the color of the gridlines of an Excel
worksheet or hide them
How to use Autosum in Multiple Worksheet Cells Quickly
How to have your free personal assistant in Mcrosoft
Excel who reads out the data to you
How to use the status bar in Microsoft Excel to do a
quick data analysis
How to calculate equal monthly payments or instalments
using a mathematical equation
Data Forms to Enter and Edit Data
View 2 worksheets in same workbook side by side
Accessing a specific worksheet in large workbooks with
multiple worksheets
Referencing a cell in another worksheet
How to perform a what-if analysis using a scrollbar
form control
An interesting
payroll solution
Future Value Solution in Microsoft Excel
Another Interesting Conditional Formatting Solution
DSUM
and Array Formulas for addition solutions
IF Function Question
How to use command buttons on a splash screen in
MS-Excel
Copy Paste Data from one Excel Worksheet to Another
How to separate comma separated values (csv) in a
worksheet cell in Microsoft Excel into rows or columns
Another
Interesting Solver solution in Microsoft Excel
Find duplicates in two different Excel worksheets
using a macro
How to count data based on multiple criteria -
countifs function
How to convert 6/5/2011 into Sunday, 6/5/2011
User Form to perform calculations
An interesting solution using conditional formatting
in Microsoft Excel 2007
Show/Hide Controls on a User-Form using a Checkbox
|