Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Display value linked to Combo Box Selection

Simple question, I think.
I have a worksheet with a two column array. First column is 2-letter state
abbreviation, second column is full state name.
In a userform, i want the user to select the 2-letter abbreviation, and I
want to display the corresponding state name in the adjacent box (listbox?
textbox?).

If I can get help with this, I would hope to use the same method to make
other, similar linked selections available on the form.

Help?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Display value linked to Combo Box Selection

Assuming the state list is A1:B50, set the combobox rowsource to A1:A50.
Then you can use the following for the _Change event procedure for your
combobox (substitute in the actual names of your controls, of course):

Private Sub ComboBox1_Change()

TextBox1.Value = Range("A1").Offset(ComboBox1.ListIndex, 1)

End Sub

--
- K Dales


"Bill" wrote:

Simple question, I think.
I have a worksheet with a two column array. First column is 2-letter state
abbreviation, second column is full state name.
In a userform, i want the user to select the 2-letter abbreviation, and I
want to display the corresponding state name in the adjacent box (listbox?
textbox?).

If I can get help with this, I would hope to use the same method to make
other, similar linked selections available on the form.

Help?
Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Display value linked to Combo Box Selection

Forgot to mention: why not use a 2-column combobox?

But if for some reason you need the setup described the method I posted
should do it
--
- K Dales


"Bill" wrote:

Simple question, I think.
I have a worksheet with a two column array. First column is 2-letter state
abbreviation, second column is full state name.
In a userform, i want the user to select the 2-letter abbreviation, and I
want to display the corresponding state name in the adjacent box (listbox?
textbox?).

If I can get help with this, I would hope to use the same method to make
other, similar linked selections available on the form.

Help?
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Display value linked to Combo Box Selection


use a dynamic range to name the two columns, e.g. "countries"

then use

Sub comboBox1_Change()
with me

..comboBox2.value =
application.worksheetfunction.vlookup(.combobox1.v alue,countries,2,false)

end with
End Sub


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=535571

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Display value linked to Combo Box Selection

Thanks Matt, this method worked perfectly for me.

"MattShoreson" wrote:


use a dynamic range to name the two columns, e.g. "countries"

then use

Sub comboBox1_Change()
with me

.comboBox2.value =
application.worksheetfunction.vlookup(.combobox1.v alue,countries,2,false)

end with
End Sub


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=535571


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Graph linked with combo boxes Sasikiran Excel Discussion (Misc queries) 2 March 12th 10 10:20 AM
Linked combo boxes Nemo New Users to Excel 2 July 18th 07 07:38 AM
Dependent (linked) combo boxes shapiro Excel Discussion (Misc queries) 3 April 26th 07 01:16 PM
Combo Box doesn't display text in linked cell Broadband Al Excel Programming 0 January 21st 06 05:49 PM
Linked Combo Boxes LRobinson3 Excel Worksheet Functions 3 November 14th 05 01:35 PM


All times are GMT +1. The time now is 10:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"