Copy worksheet from one workbook to another with VBA

keva98

New Member
Joined
Sep 6, 2014
Messages
2
I have 2 workbooks "Template" and "Target".

The macro will run from Target & should open "Template," copy sheet "MasterList" and paste it before the "Change Tracking" sheet in the "Target" workbook.

It's important to note that the name of the Target workbook will vary by project. So I can't specifically call it by name here.

Based on other posts, I've tried the following:

Workbooks.Open ("C:\Template.xlsx")
Workbooks("C:\Template.xlsx").Sheets("MasterList").Copy Before:=Workbooks(ThisWorkbook).Sheets("Change Tracking")


Unfortunately, I keep getting errors on this second line, no matter what I try. Any suggestions?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
As an addendum....I initially tried to copy the range of data A1:E1000 in "MasterList" and paste it in new sheet in the target workbook. However, the formatting was lost & I couldn't get the .PasteSpecial function to work either.

I'm using Excel 2010.
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

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