Excel Macro help

Soldato
Joined
5 Jul 2007
Posts
5,511
Location
London
Hi there,

Part of my job entails creating two spreadsheets, based on data from a report spreadsheet that is generated daily. This spreadsheet has a new name everyday, which coincides with the date.

I need to copy data from this report and copy it into a template. I then use my own macro to copy the relevant data from the template into what is known as the retail spreadsheet.

I can write a macro to import the data from the report to the template, but as the name changes everyday it will only work for that day.

So, how is it possible to import this data using a new spreadsheet everyday?

Thanks. Tom.
 
Thanks for the answer, I think the input box may be the best solution. The filename is a coded date along with a branch code, so its varies quite significantly daily.

Thanks again.
 
Hi there, thanks very much for that.

I'm pretty much clueless about macro's but I managed to do this.

I now want to copy data from the report which I now have the name of.

This is what I have so far.

A[L]C's code finishing

....
MsgBox sFileName

I have then written...

Workbooks.Open sFileName

which opens the spreadsheet.

What do I need to write to refer to this spreadsheet when I want to copy and paste.

I have:

Range ("B2:1000").Select
Selection.Copy
Windows ("Copy of Declaration Exceptions Template (Read Only).xls").Activate
Range ("A2").Select
ActiveSheet.Paste

But where I'm stuck is what do I use to refer back to the sFilename spreadsheet, as whatever I seem to type it doesn't seem to work?

Thanks for the help.
 
Back
Top Bottom