Copy/Paste parts of files (excel marcos)

[Closed]
Report
-
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
-
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

Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Hello confused

Get the name of your workbook though an Inputbox
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month