dropdown list that take data dynamiclly

E

efi

Hi all,
My problem is that I defined a column as drop down list (by using
validation).
My problem is that I want that the data that will be placed in the drop
down list will be taken from a file which I will be open in the
function "Workbook_Open".

I need each cell in the column to be defined as drop down list, so this
is why I used validation.
I don't know before I open the specific file which data will be in the
drop down list.

I didn't find any way to access to these dropdown list and to insert
data to it from VB.

If you have any other ideas how to achieve ny goal in another way, I
will be happy to hear.
thanxs.
 
S

steve

One way is to use a defined name as the list source for the validation drop
downs. Than have vb recreate the name. You can than leave the drop
downs as is and they should adjust after the code redefines the name.

Use the recorder if you need code to do this...
 
E

efi

Hi,
10x for your answer, but what is the recorder?, can you give me some
tips how to do this?
 
S

steve

efi,

To record a macro:
Go to the Tools menu
Select Macro
Select Record New Macro

Give the Macro a name in the Macro name: box.
Set where to store the macro in the Store macro in: box.
you'll probably want to put it into 'This Workbook'
Highlight (select) the range that contains the list
Than go the Insert menu
Select name
Select Define
Enter a name in the Names in workbook: box
click Add
click OK
Click the Stop record button.

Go to the Tools menu
Select Viual Basic Editor
Edit the code if needed.

Now you have code to recreate the name each time.
 
T

Tom Ogilvy

Tools=>Macro=>Record a New macro

Turns on the macro recorder

Manually perform actions you want code for. Then click the stop recording
button on the recording toolbar (which should be made visible when you start
recording). Then go to the VBE (Alt+F11) and see what you have recorded.
Modify it so you can use it as a macro in the way you want.
 

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