question about the ControlSource of a ComboBox

D

delaney_55

I have a column 'A' in my excel worksheet with the header 'Names' that
lists the names of all the people in a company (one name on each row).
Eg. A2 contains the data 'Bill', A3 contains 'Sal', A4 has 'Kim'
etc...

If I want a ComboBox to display all of these names I figured I could
modify the ControlSource property of the ComboBox by changing it to
something like 'Sheet1!A2' but that only adds the name in cell A2 to
the ComboBox. Is there any way to add the whole list of names to the
ComboBox? Note: the list of names keeps changing dynamically so I can't
do something like 'Sheet1!A2-A50'
Is there a way to reference the entire column?

Thanks for any help
 
R

Ramses

Hi

I try to explain a valuable way


Insert - Name - Define
For Name type (without quotation marks ): "Range_of_Name"
Refers to: =INDIRECT("Sheets1!A1A" &COUNTA(Sheets1!A:A)

...and add this Code into your Combobox

Private Sub Combobox1_GotFocus()
Me.Combobox1.ListfillRange = "Range_of_Name"
End Sub

Now you should get a whole List of names without blank fields :)

Best regards from switzerland ;-
 

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