Results 1 to 3 of 3

Thread: Macro or VB to copy entire worksheet from a closed file into the open file
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Oct 2008
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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

  2. #2
    Board Regular
    Join Date
    Apr 2010
    Posts
    53
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

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

    Quote Originally Posted by anderma8 View Post
    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 by Steve_; May 21st, 2019 at 03:33 PM.

  3. #3
    New Member
    Join Date
    Oct 2008
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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?

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •