Copy data from an XLSM worksheet into a XLSX worksheet

Stevep4

New Member
Joined
Aug 28, 2015
Messages
35
The XLSM file is called FileA.xlsm
The XLSX file is call FileB.xlsx

I'm trying to copy data from the XLSM tab into the XLSX tab. Let's say the tab to I want to copy from is call COPYFROM and the tab in the XLSX is COPYTO. I know the code to open the xlsx file.

Code:
Workbooks.Open Filename:="S:\Path\FileB.xlsx", ReadOnly:=True

I now need to figure out how to copy data from COPYFROM in FileA into COPYTO in FileB.
Here is the code I have so far. The second line needs to list the filename and sheet, and I'm not quite sure how to do that.

Code:
Worksheets("COPYFROM").Range("a2:v90000").Copy
    Workbook("on order TEMPLATE").Range("A2:V90000").PasteSpecial Paste:=xlPasteValues

Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this! Make sure to change the file paths to reflect where your files are located...

Code:
Sub Copy_Paste()


Dim FileA As Workbook
Dim FileB As Workbook
Set FileA = Workbooks.Open("S:\Path\FileA.xlsx")
Set FileB = Workbooks.Open("S:\Path\FileB.xlsm")


    FileA.Activate
    Worksheets("COPYFROM").Range("A2").Select
    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Copy
    FileB.Activate
    Worksheets("COPYTO").Range("A2").Select
    Selection.PasteSpecial
    Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,582
Members
449,089
Latest member
Motoracer88

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