Filling cells with multiple columns from ComboBox?

Paulfakins

New Member
Joined
Oct 9, 2003
Messages
29
I have a user form in which the user selects a part# from a 4 column combo box (part#, description, cost, labor) I have been able to put the CboBox.value and cboBox.listindex.value directly into worksheet cells. Is there a way to load the information from the other columns into the worksheet as well?

What I want is when the user chooses a part number the worksheet is automatically filled with all 4 columns of data. I have previously done this with the Index function on the worksheet, using the listindex.value to lookup the info in the parts database, but I would prefer to do it in VBA if possible
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You can use the Column property like this (first column is 0):

Code:
Private Sub ComboBox1_Change()
    ActiveCell.Value = ComboBox1.Column(0, ComboBox1.ListIndex)
    ActiveCell.Offset(0, 1).Value = ComboBox1.Column(1, ComboBox1.ListIndex)
End Sub
 
Upvote 0
Thanks! I thought it would be fairly simple. I am fairly new at VBA and am still learning language conventions. I aprreciate the help.
 
Upvote 0
You can use the Column property like this (first column is 0):

Code:
Private Sub ComboBox1_Change()
    ActiveCell.Value = ComboBox1.Column(0, ComboBox1.ListIndex)
    ActiveCell.Offset(0, 1).Value = ComboBox1.Column(1, ComboBox1.ListIndex)
End Sub
Hi Andrew,
Can i get the address of the particular range which i selected from combobox like A1, etc;
Please help me out.
 
Upvote 0

Forum statistics

Threads
1,225,489
Messages
6,185,284
Members
453,285
Latest member
Wullay

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