Consulting

Results 1 to 4 of 4

Thread: VBA script to copy workbook contents

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    12
    Location

    VBA script to copy workbook contents

    how to copy contents of workbook 1 to workbook 2 ?

  2. #2
    VBAX Expert
    Joined
    Aug 2007
    Location
    Windermere, FL, a 'burb in the greater Orlando metro area.
    Posts
    567
    Location
    Malcolm posted the following snippet the other day:
    [vba]Sub macro1()
    Workbooks.Open Filename:="your source file.xls"
    ActiveWorkbook.SaveAs "C:\your target file.xls"
    End Sub
    [/vba]
    This should take care of the job for you.

    HTH,
    Ron
    Windermere, FL

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    12
    Location
    Thanks a lot Ron.

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    but if you want to stay in the original workbook
    [VBA] Sub macro1()
    Workbooks.Open Filename:="your source file.xls"
    ActiveWorkbook.SaveCopyAs "C:\your target file.xls"
    End Sub [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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