ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vlookup using ComboBox value (https://www.excelbanter.com/excel-programming/422437-vlookup-using-combobox-value.html)

Patrick C. Simonds

Vlookup using ComboBox value
 
Is there any way to get this to work?

ComboBox1 has an employee's name. Employee List is not the active worksheet.




If Range("$A$3") = "Monday" Then

TextBox4.Text = VLOOKUP(ComboBox1.Value,'Employee
List'!$A$4:$H$1000,3,FALSE)

End If


Gary Keramidas[_2_]

Vlookup using ComboBox value
 
try creating a range name on that sheet and use it in the listbox code
instead and se if that works
TextBox4.Text = VLOOKUP(ComboBox1.Value,rngname,3,FALSE)
--


Gary K



"Patrick C. Simonds" wrote in message
...
Is there any way to get this to work?

ComboBox1 has an employee's name. Employee List is not the active
worksheet.




If Range("$A$3") = "Monday" Then

TextBox4.Text = VLOOKUP(ComboBox1.Value,'Employee
List'!$A$4:$H$1000,3,FALSE)

End If



Patrick C. Simonds

Vlookup using ComboBox value
 
I get a Variable no defined error, and Employees is highlighted. Scope is
set to workbook. Here is my current code:


If Range("$A$3") = "Monday" Then
TextBox4.Text = VLookup(ComboBox1.Value, Employees, 3, False)

End If


"Gary Keramidas" wrote in message
...
try creating a range name on that sheet and use it in the listbox code
instead and se if that works
TextBox4.Text = VLOOKUP(ComboBox1.Value,rngname,3,FALSE)
--


Gary K



"Patrick C. Simonds" wrote in message
...
Is there any way to get this to work?

ComboBox1 has an employee's name. Employee List is not the active
worksheet.




If Range("$A$3") = "Monday" Then

TextBox4.Text = VLOOKUP(ComboBox1.Value,'Employee
List'!$A$4:$H$1000,3,FALSE)

End If




Gary Keramidas[_2_]

Vlookup using ComboBox value
 
I thought you were trying to set the rowsource of another sheet. but anyway
this woroks for me.

I set up a form with a combobox, 4 textboxes and a command button.
on sheet1 I created a range name employees, from i9:m12
names were listed in column I

I set the rowsource for the combobox to employees

when I loaded the form and clicked the command button, textbox4 filled in

Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = Range("employees")
Me.TextBox4.Text = Application.VLookup(ComboBox1.Value, rng, 3, False)
End Sub

--


Gary K



"Patrick C. Simonds" wrote in message
...
I get a Variable no defined error, and Employees is highlighted. Scope is
set to workbook. Here is my current code:


If Range("$A$3") = "Monday" Then
TextBox4.Text = VLookup(ComboBox1.Value, Employees, 3, False)

End If


"Gary Keramidas" wrote in message
...
try creating a range name on that sheet and use it in the listbox code
instead and se if that works
TextBox4.Text = VLOOKUP(ComboBox1.Value,rngname,3,FALSE)
--


Gary K



"Patrick C. Simonds" wrote in message
...
Is there any way to get this to work?

ComboBox1 has an employee's name. Employee List is not the active
worksheet.




If Range("$A$3") = "Monday" Then

TextBox4.Text = VLOOKUP(ComboBox1.Value,'Employee
List'!$A$4:$H$1000,3,FALSE)

End If




Patrick C. Simonds

Vlookup using ComboBox value
 
Thank you, that did the trick.




"Gary Keramidas" wrote in message
...
I thought you were trying to set the rowsource of another sheet. but anyway
this woroks for me.

I set up a form with a combobox, 4 textboxes and a command button.
on sheet1 I created a range name employees, from i9:m12
names were listed in column I

I set the rowsource for the combobox to employees

when I loaded the form and clicked the command button, textbox4 filled in

Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = Range("employees")
Me.TextBox4.Text = Application.VLookup(ComboBox1.Value, rng, 3, False)
End Sub

--


Gary K



"Patrick C. Simonds" wrote in message
...
I get a Variable no defined error, and Employees is highlighted. Scope is
set to workbook. Here is my current code:


If Range("$A$3") = "Monday" Then
TextBox4.Text = VLookup(ComboBox1.Value, Employees, 3, False)

End If


"Gary Keramidas" wrote in message
...
try creating a range name on that sheet and use it in the listbox code
instead and se if that works
TextBox4.Text = VLOOKUP(ComboBox1.Value,rngname,3,FALSE)
--


Gary K



"Patrick C. Simonds" wrote in message
...
Is there any way to get this to work?

ComboBox1 has an employee's name. Employee List is not the active
worksheet.




If Range("$A$3") = "Monday" Then

TextBox4.Text = VLOOKUP(ComboBox1.Value,'Employee
List'!$A$4:$H$1000,3,FALSE)

End If





All times are GMT +1. The time now is 08:45 PM.

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