Combo Box question?

Javi

Active Member
Joined
May 26, 2011
Messages
440
I have a combo box with a Row Source of =(J3:J6).

J3:J6 contains the names I want the user to see and use as there selection however would like the combo box to use K3:K6 as the actual data.

I'm using this combo box on a form.

Thanks..
 

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
Perhaps this:-
Code:
Private Sub ComboBox1_Change()
With ComboBox1
 MsgBox Range(.RowSource)(.ListIndex + 1).Offset(, 1)
End With
End Sub
Mick
 
Upvote 0
So this can not be accomplished in the Properties on the combo box it self?
 
Upvote 0
The idea is you click you seletion and the code returns the Results from the cell to the right.
There may be other ways , but I do not think in the properties.
 
Upvote 0
You can set the source to J3:K6, the column count to 2 and the bound column to 2.

Then when you use ComboBox1.Value you'll get the value from the 2nd column, which you can hide.

Not sure if that's what you want.

PS You can hide the 2nd column by setting it's columb width to 0.
 
Upvote 0
Code:
With ComboBox1
    .ColumnCount = 2
    .ColumnWidths = ";0"
    .BoundColumn = 2
    .TextColumn = 1
    .List = Range("J3:K6")
End With

If you fill the ComboBox with the above code. The values from column J will be what is seen in the combo box, and ComboBox1.Text will return that. Combobox1.Value will return the value from column J of the selected item.
 
Upvote 0
OOOps. Typo above

"ComboBox1.Value will return the value from column K of the selected item>"
 
Upvote 0
mike

Don't you need Value after the range?

I always get that wrong.:)
 
Upvote 0
Norie That's exactly what I am looking for however when I make those modifications I do not get the values in the next cell. I am getting blank.
 
Upvote 0
Mikerickson I'm relatively new to VBA so please have patience. Would this code be put under the combo box or somewhere else?
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,813
Members
449,469
Latest member
Kingwi11y

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