J
jeff.white
This is a second post, trying to 'word' it better than my earlier
post. My excel file: contains columns A to U with about 1600 rows of
data. The data is all employee information, including Employee ID,
Name, Supervisor Name, Hire Date, Salary...etc.
What I have so far is a user form with a combobox1 and a textbox1.
combobox1 properties include the row source to equal: A2:A1600
Column A is the employee ID. This works fine, the ID show up in the
drop down.
For the Textbox1 I would like the value from Column B (employee name)
to be displayed where the ID is shown in the combobox1.
I'm very new to VBA and userforms, here is what I have so far....
Private Sub ComboBox1_Change()
Dim ID
ID = ComboBox1.Value
If ComboBox1.Value <> "" Then
TextBox1.Text = ActiveCell.Offset(0, 1).Value
End If
End Sub
I know this is way wrong, but what shows up in the Textbox is the
Column Heading 'Name' from column B. I'm looking for, of course, the
name of the employee. For example, if cell A50's value is 5300 and
B50 is John Smith...it is John Smith I'd like to see in textbox1. I
hope this is making sense....as suggested from other postings, I'm
trying to explain the problem as well as give examples of what I
tried...thanks for those that respond!....
post. My excel file: contains columns A to U with about 1600 rows of
data. The data is all employee information, including Employee ID,
Name, Supervisor Name, Hire Date, Salary...etc.
What I have so far is a user form with a combobox1 and a textbox1.
combobox1 properties include the row source to equal: A2:A1600
Column A is the employee ID. This works fine, the ID show up in the
drop down.
For the Textbox1 I would like the value from Column B (employee name)
to be displayed where the ID is shown in the combobox1.
I'm very new to VBA and userforms, here is what I have so far....
Private Sub ComboBox1_Change()
Dim ID
ID = ComboBox1.Value
If ComboBox1.Value <> "" Then
TextBox1.Text = ActiveCell.Offset(0, 1).Value
End If
End Sub
I know this is way wrong, but what shows up in the Textbox is the
Column Heading 'Name' from column B. I'm looking for, of course, the
name of the employee. For example, if cell A50's value is 5300 and
B50 is John Smith...it is John Smith I'd like to see in textbox1. I
hope this is making sense....as suggested from other postings, I'm
trying to explain the problem as well as give examples of what I
tried...thanks for those that respond!....