ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A Simply ComboBox Selection returns value to TextBox (https://www.excelbanter.com/excel-programming/332670-simply-combobox-selection-returns-value-textbox.html)

thom hoyle

A Simply ComboBox Selection returns value to TextBox
 
I have a userform with a simply ComboBox named (cboAtty) who's ROWSOURE
PROPERTIES are =Data!A2:A30, with a SHEET Called Data, with info on A2:B30,
The info is a Name Listing in Column A, with Bar# in Column B)(A2:B30).

On the userform is COMBOBOX called cboAtty & a TEXTBOX called (tbBar)
Here is my Code that always fails:

Private Sub cboAtty_Change()
tbBar.Value = Application.VLookup(cboAtty.Value, Sheet1.Range("A2:B30"), 2,
False)
End Sub

Objective is to return the cell info In Column B based on ComboBox selection
of Column A. Into my TextBox.
I don't know what Value Sheet1 has, weather it's empty of same data, seems
to not matter.

Thanks on this.. I'm just stuck, read all the posts... still to no avail.


Toppers

A Simply ComboBox Selection returns value to TextBox
 
Hi,
This definitely works for me:

Private Sub cboAtty_Change()
tbBar.Value = Application.VLookup(cboAtty.Value,
Worksheets("Data").Range("A2:B30"), 2, False)
End Sub



"thom hoyle" wrote:

I have a userform with a simply ComboBox named (cboAtty) who's ROWSOURE
PROPERTIES are =Data!A2:A30, with a SHEET Called Data, with info on A2:B30,
The info is a Name Listing in Column A, with Bar# in Column B)(A2:B30).

On the userform is COMBOBOX called cboAtty & a TEXTBOX called (tbBar)
Here is my Code that always fails:

Private Sub cboAtty_Change()
tbBar.Value = Application.VLookup(cboAtty.Value, Sheet1.Range("A2:B30"), 2,
False)
End Sub

Objective is to return the cell info In Column B based on ComboBox selection
of Column A. Into my TextBox.
I don't know what Value Sheet1 has, weather it's empty of same data, seems
to not matter.

Thanks on this.. I'm just stuck, read all the posts... still to no avail.


thom hoyle

A Simply ComboBox Selection returns value to TextBox
 
Worked like a charm, Thank you Toppers... seems my code was screwed up...

"Toppers" wrote:

Hi,
This definitely works for me:

Private Sub cboAtty_Change()
tbBar.Value = Application.VLookup(cboAtty.Value,
Worksheets("Data").Range("A2:B30"), 2, False)
End Sub



"thom hoyle" wrote:

I have a userform with a simply ComboBox named (cboAtty) who's ROWSOURE
PROPERTIES are =Data!A2:A30, with a SHEET Called Data, with info on A2:B30,
The info is a Name Listing in Column A, with Bar# in Column B)(A2:B30).

On the userform is COMBOBOX called cboAtty & a TEXTBOX called (tbBar)
Here is my Code that always fails:

Private Sub cboAtty_Change()
tbBar.Value = Application.VLookup(cboAtty.Value, Sheet1.Range("A2:B30"), 2,
False)
End Sub

Objective is to return the cell info In Column B based on ComboBox selection
of Column A. Into my TextBox.
I don't know what Value Sheet1 has, weather it's empty of same data, seems
to not matter.

Thanks on this.. I'm just stuck, read all the posts... still to no avail.



All times are GMT +1. The time now is 08:43 AM.

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