Macro: Copy Worksheet To Another Workbook

  • Hi All, i am a beginnner in macro.
    I need to come up with a macro code to copy 2 worksheet from 2 workbooks to my current workbook. I do not know what is the code such that i can copy different worksheets from other workbooks to a currently opened workbook.

    Below is the scenerio i want to achieve:

    worksheet1 from workbook1 need to be copied and paste as a worksheet in workbook3.
    worksheet1 from workbook2 need to be copied and paste as a worksheet in workbook3.
    workbooks will eventually contain 2 worksheets which are from workbook1 & 2.

    PLs help. Thank

  • Re: To Copy Worksheets From Other Workbooks To A Currently Opened Workbook


    If you use this macro it will copy Sheet1 Workbook1 to Workbook3 etc so you will be left with your originals in Workbook1 and Workbook2.



  • Re: To Copy Worksheets From Other Workbooks To A Currently Opened Workbook


    Another way


    Code
    With Workbooks("Workbook1.xls")
            .Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy _
                Before:=Workbooks("Workbook3.xls").Sheets(1)
        End If
  • Re: To Copy Worksheets From Other Workbooks To A Currently Opened Workbook


    Quote from Dave Hawley

    Another way


    Code
    With Workbooks("Workbook1.xls")
            .Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy _
                Before:=Workbooks("Workbook3.xls").Sheets(1)
        End If



    Hi guys thanks alot for your infomation.
    Dave, what does the underscore after the copy mean "Copy _"?

  • Re: Macro: Copy Worksheet To Another Workbook


    Hi all,


    I also want to copy all sheets of the workbook to another workbook. However, I wonder about how can I code with "for" or sth. like that.


    I want to copy all sheets of workbook named "27032013" to a workbook named "MasterFile".


    And on which workbook should I write the necessary codes?


    Thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!