+ Reply to Thread
Results 1 to 4 of 4

vba to copy all sheets of open workbook to a new sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,142

    vba to copy all sheets of open workbook to a new sheet

    Hi All

    I have a workbook named AAA with several sheets named page 1 page 2 and so on.

    Target: to copy all sheets on that workbook AAA,create a new book and paste all the sheets with same sheet tab name of AAA.

    However the macro should be activated from worksheet AAA to do the task but do not save the new workbook as I will do it manually.


    Thanks if anyone can assist

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: vba to copy all sheets of open workbook to a new sheet

    Hi,

    All you need do is copy an array of sheets
    Sub copySheets()
    thisworkbook.sheets(array("Page 1", "Page 2", "Page 3")).Copy
    End Sub
    Edit: I missed that you wanted all the sheets- AlphaFrog has given you the simplest solution for that.
    Last edited by xlnitwit; 01-16-2017 at 09:15 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: vba to copy all sheets of open workbook to a new sheet

    Sub Copy_Sheets_To_New_Workbook()
        ThisWorkbook.Sheets.Copy
    End Sub
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,142

    Re: vba to copy all sheets of open workbook to a new sheet

    Hi xlnitwit & AlphaFrog

    Thank you for both solution works a charm

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Simple Open Workbook, Copy Sheet, Paste In New Workbook Question
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2013, 02:10 PM
  2. open files in folder and copy sheets to new workbook
    By matrix_xrs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2013, 06:56 AM
  3. Copy 2 sheets from a open workbook and paste to a closed workbook
    By grimston in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2012, 03:27 PM
  4. [SOLVED] COPY from an open workbook with particular sheet and columns to active workbook
    By purin0c0 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-12-2012, 03:57 PM
  5. Macro, copy UNLOCKED cell range of sheet in open workbook to workbook template
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-31-2012, 11:18 AM
  6. Replies: 0
    Last Post: 03-06-2006, 01:07 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1