DataSource for ComboBox in UserForm

S

Stuart Grant

I have a user form in a worksheet with several text boxes and a combobox. I
cannot find how to make the data source of the combobox a column in another
worksheet.
John Walkenbach's Excel 2003 Bible say that a combobox in a userform has a
ListFillRange but it doesn't seem to have - only Data Source.
I tried putting "=Trandesc!Range("A1:A66") as the Data Source but this gives
an error message.
Can someone put me right ?
Stuart
 
D

Dave Peterson

It's really a userform, right?

If yes, then look for .rowsource in the properties window.
And use: trandesc!a1:a66

You can also do it in code:
 
D

Dave Peterson

It's really a userform, right?

If yes, then look for .rowsource in the properties window.
And use: trandesc!a1:a66

You can also do it in code:

Option Explicit
Private Sub UserForm_Initialize()
With Me.ComboBox1
.RowSource = "" 'in case you didn't clear the properties window
.RowSource = ThisWorkbook.Worksheets("Trandesc") _
.Range("a1:a66").Address(external:=True)
End Sub
 

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