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

anderma8

New Member
Joined
Oct 29, 2008
Messages
32
Office Version
365
Platform
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
 

Some videos you may like

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.

Steve_

Board Regular
Joined
Apr 28, 2010
Messages
167
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:

anderma8

New Member
Joined
Oct 29, 2008
Messages
32
Office Version
365
Platform
Windows
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,099,134
Messages
5,466,869
Members
406,506
Latest member
Patb3

This Week's Hot Topics

Top