John McMullan
New Member
- Joined
- Dec 16, 2016
- Messages
- 3
Good morning,
I am using some code I borrowed from this very forum but unfortunately I cannot get it to work as I hoped and my lack of any knowledge has prompted me to ask for help.
This is the code for my sheet 'App'
I have a button and when pressed it opens the form as expected, with ComboBox1 and TextBox1 inside. Odd thing is if I select H006-006-048 is displays H001-003-016 in the TextBox1, which is the wrong row. Every other selection causes a Run-time error '13' Type Mismatch.
Below is a table on sheet 'App' I am pulling data from, blank cells are intentional.
<tbody>
</tbody>
When I choose an option from the ComboBox1 from A column I want it to display all the data in TextBox1 that is on that line, for example
H003-001-041 is selected and I want all the data H003-004-001, H001-016-100, H001-016-001 and H006-006-146.
Could anyone have a look and see what I may have done wrong. I hope I have provided enough information and explanation.
Regards,
John.
I am using some code I borrowed from this very forum but unfortunately I cannot get it to work as I hoped and my lack of any knowledge has prompted me to ask for help.
This is the code for my sheet 'App'
Code:
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = Worksheets("App").Range("A2:A9").Value
End Sub
Private Sub ComboBox1_Change()
TextBox1.Text = Application.VLookup(ComboBox1.Value, Worksheets("App").Range("B2:G10"), 2, False)
End Sub
I have a button and when pressed it opens the form as expected, with ComboBox1 and TextBox1 inside. Odd thing is if I select H006-006-048 is displays H001-003-016 in the TextBox1, which is the wrong row. Every other selection causes a Run-time error '13' Type Mismatch.
Below is a table on sheet 'App' I am pulling data from, blank cells are intentional.
A | B | C | D | E | F | G |
H001-005-012 | H006-006-048 | H001-003-016 | H040-001-030 | H001-003-014 | ||
H004-001-021 | H001-002-001 | H001-005-019 | H004-008-005 | H004-001-001 | H004-001-022 | H004-003-001 |
H006-006-048 | H004-003-001 | H001-005-012 | H001-005-002 | H001-003-016 | ||
H003-001-041 | H003-004-001 | H001-016-100 | H001-016-001 | H006-006-146 | ||
H032-014-005 | H017-013-168 | |||||
H006-009-029 | None | |||||
H006-009-037 | None | |||||
H017-018-400 | H017-016-303 | |||||
H006-009-029 | H017-018-401 | H001-016-002 |
<tbody>
</tbody>
When I choose an option from the ComboBox1 from A column I want it to display all the data in TextBox1 that is on that line, for example
H003-001-041 is selected and I want all the data H003-004-001, H001-016-100, H001-016-001 and H006-006-146.
Could anyone have a look and see what I may have done wrong. I hope I have provided enough information and explanation.
Regards,
John.