PDA

Click to See Complete Forum and Search --> : VBA Lists in Excel 97


francd1
Jun 7th, 2005, 10:36 AM
Hi,

I'm sure this is a fairly simple question but I don't seem to be able to find a way of acheiving the result I'm after:

I have a macro the accesses a number of files and reformats the data within them. The path specified within the macro has a value in it which I would like to make a variable.

I would then like to update these variable using a list box in a seperate worksheet. The user needs to be able to choose from a selection of userids and the choice then needs to update the path within the specified macro.

Can anyone tell me how to

A. Create the List Box and update with the necessary id's.
B. Amend the macro so that the required part of the file path accepts the value passed from the List Box.

Many thanks

NeedSomeAnswers
Jun 8th, 2005, 10:40 AM
Post your Macro code, this will mke it easier for people to see what it is you want to do.

Am i right in saying that you have a path, with a filename in it, and you would like to make the filename dynamic, depending on some sort of choice by the user???

Where are you getting your id's from ??, this will effect how you fill your listbox.

Ecniv
Jun 9th, 2005, 09:02 AM
There are several ways to fill the list.
1) make a table, use code to fill the table then requery the listbox to refresh it.
2) use a (class) module code to fill the list box, and either put in code to get from a file you select/pass to it or pass the module an array or collection to display
3) read the file and put in a list of variables then requery the listbox.
4) Some other method

As to the other part, in the list hold:
ID (unique), Path and filename, Display name
Set the format to 3 columns, with widths : 0;0;1
The user will see the display bit, the code can grab the text in column (0) for getting the id and column(1) for getting the path.
This can then be passed to the sub as a string in a variable.