filling combo box

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

What is the best way to fill a combo box when the data is stored in an
external file?
 
Mike,

Open the file
Either copy the data to the combobox file and point the combobox at that
data, or add them to the combobox
Close the file

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Is there a site with sample code? This is a combo box on the worksheet, not
a userform.
 
Thanks for the code. I would prefer to use the first code example. But I
am having trouble programming with columncount property. I have 3 columns
to be displayed in the combobox.
I do I do that? BoundColumn will be set to 1.

Lastly, how do I sort the values within the combo box?
 
This pseudo code should show you how to do it.

Dim rng as Range
Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With Activesheet.
.sort Key1:=.Range("A1'), _
Order1:=xlAscending, Header:=xlNo
set rng = .Range("A1").CurrentRegion
End With
With Userform1.Combobox1
.Columncount = 3
.List = rng.Value
.BoundColumn = 1
End With
Activeworkbook.Close SaveChanges:=False
 

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

Back
Top