Select workbook with variable name.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have some code that opens three workbooks simultaneously. Two workbooks
will contain source data while the third is the workbook to which I want to
copy source data. The destination workbook is not really a problem as it
will always have the same name so I can use that in the code. The two
workbooks with the source data will have names that change from week to week.
The name will be something like "Workbook Name_mmddyy" - the date being the
date on which the file was created. I will need to activate each of these
source workbooks in order to copy data. How do I reference the workbooks
when I don't have a name?

Thanks-
 
You will need to be creative here. I don't have all your details, but you
could store all your source files in a separate folder. Then code an array to
return all the file names contained in that folder and process them. Once
they have been processed, move them to an archive folder, delete them, or
alter their name slightly, like add a 1 at the beginning of the file name.

If the latter method is used, then set your code not to process any file
with a leading 1 in the file name.

Very do-able.

Hope this helps.
 

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