Copy sheet from Workbook 1 and move to the end Workbook 2

IAP

New Member
Joined
Aug 6, 2020
Messages
8
Office Version
  1. 2010
Platform
  1. Windows
I have Tried using almost every code on the internet and just tried MrExcels code below, and I just keep getting errors.
Sub CopySheetToNewPage ()
Workbooks.Open Filename:="C:\Users\jfjen\Desktop\New Mold Program\AAA Master File\Location Forms.xlsm"
Sheets("Location 2").Copy After:=Workbooks("A12.Basic Reports.xlsm").Sheets(Sheets.Count)
ActiveSheet.Name = "Location 2"
Workbooks("A12.Basic Reports.xlsm").Close savechanges:=False
End Sub

Workbook name - Location Forms.xlsm has a sheet named Location 2.
I want to copy and Paste sheet named Location 2 into Workbook named A12.Basic Reports.xlsm
After a sheet named Location 1
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi & welcome to MrExcel.
How about
VBA Code:
Sub CopySheetToNewPage()
   Workbooks.Open Filename:="C:\Users\jfjen\Desktop\New Mold Program\AAA Master File\Location Forms.xlsm"
   Sheets("Location 2").Copy , Workbooks("A12.Basic Reports.xlsm").Sheets("Location 1")
   Workbooks("A12.Basic Reports.xlsm").Close True
End Sub
 
Upvote 0
Thank You for the Reply
workBooks.Open filename:="C:\Users\jfjen\Desktop\New Mold Program\AAA Master File\Location Forms.xlsm"
This line is Highlighted in yellow.
 
Upvote 0
Does that file exist in that location?
 
Upvote 0
Does that file exist in that location?
Yes, Just Checked. I did notice there was a space missing in that line and corrected.
However, now the next line is highlighted
Sheets("Location 2").Copy , Workbooks("A12.Basic Reports.xlsm").Sheets("Location 1")
 
Upvote 0
What error message & number do you get?
 
Upvote 0
In that case check that the sheet name are correct (no leading trailing spaces) & also check the workbook name is correct.
 
Upvote 0
In that case check that the sheet name are correct (no leading trailing spaces) & also check the workbook name is correct.
I did as you suggested and tried to erase here and there and then put back blindly, but nothing changed.
This is what I got on almost every code that I uploaded to try and make this work.
 
Upvote 0
I did, Nothing changed. See Below
Sub CopySheetToNewPage()
workBooks.Open filename:="C:\Users\jfjen\Desktop\New Mold Program\AAA Master File\Location Forms.xlsm"
Sheets("Location1").Copy , workBooks("A12.Basic Report.xlsm").Sheets("Location 2")
workBooks("A12.Basic Reports.xlsm").Close True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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