ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box List Question (https://www.excelbanter.com/excel-programming/348522-combo-box-list-question.html)

ssjody

Combo Box List Question
 
I have a list of 8 things on a sheet that I have named OrionMakeCodes
they are as follows:
(N)one
(G)M
(C)rysler
(F)ord
(T)ruck
(E)uropean
(A)sian
(X)ception

I am listing these in a combo box by setting the row source to
OrionMakeCodes which populates my Combo box

When I pick a value from this Combo box, instead of setting a value of
what you see in the list, I want it to just set the Letter in
Parenthesis on another sheet which is:
Set wo = Worksheets("cpToOrionMakeCodes")

So my basic question is how do I list one set of values in a combo box
and pass another value based on the choice?

I know this has to be a really simple thing to do but I'm new to VBA
and I'm having trouble figuring it out.

Thanks Jody


Tom Ogilvy

Combo Box List Question
 
There are a couple of ways you can do it, but one way is to use the click
event. (don't link the combobox to any cells unless you want the text
selected entered somewhere else as well).

Private Sub Combobox1_Click()
Dim wo as worksheet
Dim s as String, s1 as String
if Combobox1.ListIndex < -1 then
s = Combobox1.Value
s1 = Mid(s,2,1)
Set wo = Worksheets("cpToOrionMakeCodes")
wo.Range("B9").Value = s1
End If
End Sub

--
Regards,
Tom Ogilvy

"ssjody" wrote in message
oups.com...
I have a list of 8 things on a sheet that I have named OrionMakeCodes
they are as follows:
(N)one
(G)M
(C)rysler
(F)ord
(T)ruck
(E)uropean
(A)sian
(X)ception

I am listing these in a combo box by setting the row source to
OrionMakeCodes which populates my Combo box

When I pick a value from this Combo box, instead of setting a value of
what you see in the list, I want it to just set the Letter in
Parenthesis on another sheet which is:
Set wo = Worksheets("cpToOrionMakeCodes")

So my basic question is how do I list one set of values in a combo box
and pass another value based on the choice?

I know this has to be a really simple thing to do but I'm new to VBA
and I'm having trouble figuring it out.

Thanks Jody




ssjody

Combo Box List Question
 
Worked Perfectly! Thanks



All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com