Question on copy sheet to a existing workbook (2003)

duckconut

New Member
Joined
May 23, 2013
Messages
4
Hello

I have 2 workbook files, for example: A.xls and B.xls and A is a template report format, B contains data only. And they are in different directory. ie. C:\Template\A.xls and C:\Data\B.xls

What I want to run in macro is copy sheet1 of B.xls to Data01(sheet's name) of A.xls

I cannot do it through the record macro function. (Excel 2003)

Sorry if this is a newbie question.. Any suggestions will be appreciated.

Thanks you!!!
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
If the "A.xls" and "B.xls" books are open.
Workbooks("A").Worksheets("TemplateSheetName").Copy Before:=Workbooks("B").Sheets(1)
 
Upvote 0
To add before
Workbooks.Open "d:\path\B.xls"
Workbooks("A").Worksheets("TemplateSheetName").Copy Before:=Workbooks("B").Sheets(1)
Workbooks("B").Close True
 
Upvote 0
Thanks for the reply.
Are those codes working in Excel 2003..? Coz I try the codes but with no luck..
 
Upvote 0
Yes, it works in Excel 2003.
Code:
'To enter a full path and a real name of B-book
Workbooks.Open "d:\path\B.xls"
'A - change to a real name of A-book and TemplateSheetName to a real name of a template sheet in then A-book.
Workbooks("A").Worksheets("TemplateSheetName").Copy Before:=Workbooks("B").Sheets(1)
'B - change a real name of B-book
Workbooks("B").Close True
If you have a mistake, please, write me its string in the code
Regards,
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,716
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top