Drop Down List

K

klafert

I am creating a form in Excel and need a drop down list. The data is coming
from another file. Actual an export from another program, a .csv file. I
may be updated now and then. How do I create a drop down box so, I can
choose entries from the .csv. I will have two possible three. Most I will
choose one choice, like customer names, but on choice will be a ship to
address. So, it will pull up a whole address.
 
S

ShaneDevenshire

Hi,

Assuming you mean UserForm when you say form -

If you want the userform to pick up the unique items from the csv file you
should open the file first, although it may be possible to do it from a
closed file it's going to require much fancier coding. Second, the
description at the contextures site probably won't really address the details
of your problem, it is an overview of data validation.

What you need to do is have your code produce a list of unique entries from
each of the appropriate fields from the incoming csv file. You can record
much of that, after which you can show the code here at the newsgroup and ask
for help modifying it. I would consider recording the command Data, Filter,
Advanced Filter, Unique records command, one at a time for each of the fields
you will want to have lists for. Next I would record the naming of each of
these list. And that is the name I would use as the Row Source for each of
the combo boxes on the user form.

Even if by "form" you don't mean user form, you can still use the above idea
to create unique lists for Data, Validation Lists. In that case you use the
name of the ranges in the Source box for the List option. To create a unique
list you can manually use the Data, Filter, Advanced Filter, Unique records
command. Suppose you open the csv file and there are three fields you want
to provide drop downs for - select one of those columns with its title and
choose Data, Filter, Advanced Filter, turn on Copy to another location, make
sure the List range is the one you highlighted, leave the Criteria empty, in
the Copy to box select the top cell where you want the unique list to be
placed, check Unique records only and click OK. Repeat this for each column
for which you want a pick list. Then proceed with the Data, Validation
command described at the contexture website.

One question - why not turn on AutoFilters for the incoming csv data? It
might be easier. But that's just a thought.

If this helps, click the Yes button.
 

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