Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is there a way to link a textbox to a combobox list?
I have a combobox1 on my userform that I want to be able to select a item on that list and which in turn puts an associated item in textbox1. To give you an example: My list in sheet3("list") A B k5400 Travel K5000 Physio K5601 Surg and so on.....ComboBox1 is linked to column "A" If I select "K5400" in the combobox1 then I want "Travel" to come up in textbox1 any ideas? -- capt |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How about something like:
Option Explicit Private Sub ComboBox1_Change() With Me.ComboBox1 If .ListIndex < 0 Then Me.TextBox1.Value = "" Else Me.TextBox1.Value = .List(.ListIndex, 1) End If End With End Sub Private Sub CommandButton1_Click() Unload Me End Sub Private Sub UserForm_Initialize() With Me.ComboBox1 .RowSource = Worksheets("Sheet1").Range("A1:B3").Address(extern al:=True) .ColumnCount = 2 .BoundColumn = 1 .ColumnWidths = "22;0" 'hide the second column End With End Sub capt wrote: Is there a way to link a textbox to a combobox list? I have a combobox1 on my userform that I want to be able to select a item on that list and which in turn puts an associated item in textbox1. To give you an example: My list in sheet3("list") A B k5400 Travel K5000 Physio K5601 Surg and so on.....ComboBox1 is linked to column "A" If I select "K5400" in the combobox1 then I want "Travel" to come up in textbox1 any ideas? -- capt -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks very much Dave,
It`s very complicated, but it works well. -- capt "Dave Peterson" wrote: How about something like: Option Explicit Private Sub ComboBox1_Change() With Me.ComboBox1 If .ListIndex < 0 Then Me.TextBox1.Value = "" Else Me.TextBox1.Value = .List(.ListIndex, 1) End If End With End Sub Private Sub CommandButton1_Click() Unload Me End Sub Private Sub UserForm_Initialize() With Me.ComboBox1 .RowSource = Worksheets("Sheet1").Range("A1:B3").Address(extern al:=True) .ColumnCount = 2 .BoundColumn = 1 .ColumnWidths = "22;0" 'hide the second column End With End Sub capt wrote: Is there a way to link a textbox to a combobox list? I have a combobox1 on my userform that I want to be able to select a item on that list and which in turn puts an associated item in textbox1. To give you an example: My list in sheet3("list") A B k5400 Travel K5000 Physio K5601 Surg and so on.....ComboBox1 is linked to column "A" If I select "K5400" in the combobox1 then I want "Travel" to come up in textbox1 any ideas? -- capt -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi both
Wouldn't it be simpler just to set the LinkedCell property on both the combobox and the textbox to the same cell; have the combobox ListFillRange set to columns A and B; and have Column2 as the BoundColumn? Best rgds Chris Lav "capt" wrote in message ... Thanks very much Dave, It`s very complicated, but it works well. -- capt "Dave Peterson" wrote: How about something like: Option Explicit Private Sub ComboBox1_Change() With Me.ComboBox1 If .ListIndex < 0 Then Me.TextBox1.Value = "" Else Me.TextBox1.Value = .List(.ListIndex, 1) End If End With End Sub Private Sub CommandButton1_Click() Unload Me End Sub Private Sub UserForm_Initialize() With Me.ComboBox1 .RowSource = Worksheets("Sheet1").Range("A1:B3").Address(extern al:=True) .ColumnCount = 2 .BoundColumn = 1 .ColumnWidths = "22;0" 'hide the second column End With End Sub capt wrote: Is there a way to link a textbox to a combobox list? I have a combobox1 on my userform that I want to be able to select a item on that list and which in turn puts an associated item in textbox1. To give you an example: My list in sheet3("list") A B k5400 Travel K5000 Physio K5601 Surg and so on.....ComboBox1 is linked to column "A" If I select "K5400" in the combobox1 then I want "Travel" to come up in textbox1 any ideas? -- capt -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Control Toolbox Textbox and Linked Cells | Excel Discussion (Misc queries) | |||
VLOOKUP, linked cell &combobox | Excel Worksheet Functions | |||
select from combobox and show a price in textbox | New Users to Excel | |||
combobox /textbox value | Excel Discussion (Misc queries) | |||
UserForm TextBox/ComboBox question | Excel Discussion (Misc queries) |