Userform - ComboBox fills TextBox not working

T

thom hoyle

Thanks for looking at this.
Form Data:
I have a multipage userform. On page 3, I have a dropdown combobox called
cboAtty that autofills from ROWSOURSE properties =Data!A2:A30 (Sheet Data).
This part works fine.
Also, located on the same form is a TexBox called tbBar:

Data:
On another sheet called Data I have the same info as A2:A30, then in B2:B30
a number associated to each A column data.
Now Back to the Combo Box called cboAtty, I have the following Code that
fails with the message.
Run-time error '-2147352571 (80020005)':
Could not set the Value property. Type mismatch

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

My Objective is to have the TextBox tbBar to autofill based on my selection
of the DropDown ComboBox called cboAtty.
Thanks
 
T

Toppers

Thom,

I emulated your code and it worked fine for me (in a single and multi-page
userform).

In your note to say the RowSource is in a sheet named Data and then further
on you say there is another sheet named Data - I was slightly confused by
this. In my testing I used the same A2:A30 for both RowSource and VLOOKUP.

I note you reference Sheet1 in you VLOOKUP -is this correct? Should it (does
it) reference the sheet Data?

Your error message suggests (to me) a data mismatch.

Sorry I can't be more helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top