Copy/Paste parts of files (excel marcos)

Closed
confused - Jul 22, 2009 at 09:33 AM
Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 - Jul 22, 2009 at 11:57 PM
Hello,

I'm trying to create a macro that will copy a section of another excel file into the excel file that I'm running the marco on, then continue to run the marco in the same excel file. When I recorded the marco, it hard coded the file name of the current excel file into the VB code. However, I want to run this macro on many different files, but each time copying and pasting the same excel file. Here is the VB i'm having trouble with:

Windows("extended lookup table.xls").Activate
Columns("A:E").Select
Selection.Copy
Windows("FILE001.xls").Activate
Range("U1").Select
ActiveSheet.Paste

FILE001 changes each time I run the marco, but doing it this way, it always wants to refer back to the original file I created the marco with. "extended lookup table.xls" will always remain the same.

Any Advice/Help?

Thanks a lot!
Confused

1 reply

Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 307
Jul 22, 2009 at 11:57 PM
Hello confused

Get the name of your workbook though an Inputbox
1