Macro or VB to copy entire worksheet from a closed file into the open file

anderma8

New Member
Joined
Oct 29, 2008
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hello,

I've read a fewof the threads on how to do this but I think they are more involved in what Iam trying to do… I have a current XLSMfile. When the user opens it, I want to importa particular worksheet copied into the current file where I have formulas inplace to interrogate the new data.

Thank you!
Mark
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hello,

I've read a fewof the threads on how to do this but I think they are more involved in what Iam trying to do… I have a current XLSMfile. When the user opens it, I want to importa particular worksheet copied into the current file where I have formulas inplace to interrogate the new data.

Thank you!
Mark

Code:
Private Sub Workbook_Open()
    Set WB_CopySource = Workbooks.Open("C:\Support\Test.xlsx")   ' Workbook to copy FROM
    WB_CopySource.Sheets("Sheet1").Select  ' Sheet to copy
    Sheets("Sheet1").Copy Before:=Workbooks(ThisWorkbook.Name).Sheets(1) ' Where to copy the sheet TO
    WB_CopySource.Close ' Close the other WB
End Sub

That should get you started
 
Last edited:
Upvote 0
Thanks for the suggestion. I'm now working with your version as well as another and they both fail trying to paste to the open file, so I'm close... I'm working in Excel 2016 if that helps?
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

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