Workbooks with variable names
"bpmccoy" wrote in message
...
Hi,
I'm writing a macro to copy and paste value froms from 2 workbooks into
a third workbook. The filenames will vary according to month.
Let's say my files a "Summary Oct04.xls", "Mgt Oct04.xls" and "Board
Oct04.xls". Obviously for November the filenames will be different.
How can I define these to the macro will copy from the relevant
worksheet to the correct workbook, regardless of the filename.
I assume Summary is the target for Mgt & Board. I also assume the latter
part of the filename will always be 5 characters (MMMYY).
pastefilename = "Summary " + Mid(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 8, 5) + ".xls"
Incorporate pastefilename into the paste part of your macro.
Ian
|