+ Reply to Thread
Results 1 to 5 of 5

creating new workbook macro

  1. #1
    LindaM
    Guest

    creating new workbook macro

    Hi, I've looked for this but can't find it exactly.

    I need a macro to :
    copy 7 specific sheets from one workbook (not the whole book) to a new book
    ask the user for a name
    save the new book as that name

    Thanks in advance
    --
    Linda M

  2. #2
    Bob Phillips
    Guest

    Re: creating new workbook macro


    Worksheets(Array("Sheet1", "Sheet2","Sheet3",
    "Sheet4","Sheet5","Sheet6","Sheet7")).Copy
    ans = inputbox("Name the new workbook"
    activeworkbook.SaveAs Filename:= "C:\myDir\" & ans & ".xls"

    --
    HTH

    Bob Phillips

    "LindaM" <LindaM@discussions.microsoft.com> wrote in message
    news:01247991-7EFA-49F2-A975-AE50CFC59F1A@microsoft.com...
    > Hi, I've looked for this but can't find it exactly.
    >
    > I need a macro to :
    > copy 7 specific sheets from one workbook (not the whole book) to a new

    book
    > ask the user for a name
    > save the new book as that name
    >
    > Thanks in advance
    > --
    > Linda M




  3. #3
    LindaM
    Guest

    Re: creating new workbook macro

    Thank you very much, Bob. Just what I wanted
    --
    Linda M


    "Bob Phillips" wrote:

    >
    > Worksheets(Array("Sheet1", "Sheet2","Sheet3",
    > "Sheet4","Sheet5","Sheet6","Sheet7")).Copy
    > ans = inputbox("Name the new workbook"
    > activeworkbook.SaveAs Filename:= "C:\myDir\" & ans & ".xls"
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "LindaM" <LindaM@discussions.microsoft.com> wrote in message
    > news:01247991-7EFA-49F2-A975-AE50CFC59F1A@microsoft.com...
    > > Hi, I've looked for this but can't find it exactly.
    > >
    > > I need a macro to :
    > > copy 7 specific sheets from one workbook (not the whole book) to a new

    > book
    > > ask the user for a name
    > > save the new book as that name
    > >
    > > Thanks in advance
    > > --
    > > Linda M

    >
    >
    >


  4. #4
    Jim May
    Guest

    Re: creating new workbook macro

    Bob:

    Is there a Isgrouped property, or the like that you could
    "Group the sheets (using either shift or control keys) to Copy?
    My google search didn't turn up anything.

    TIA,
    Jim


    "Bob Phillips" <phillips@tiscali.co.uk> wrote in message
    news:%23FaiKq4WFHA.3584@TK2MSFTNGP14.phx.gbl...
    >
    > Worksheets(Array("Sheet1", "Sheet2","Sheet3",
    > "Sheet4","Sheet5","Sheet6","Sheet7")).Copy
    > ans = inputbox("Name the new workbook"
    > activeworkbook.SaveAs Filename:= "C:\myDir\" & ans & ".xls"
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "LindaM" <LindaM@discussions.microsoft.com> wrote in message
    > news:01247991-7EFA-49F2-A975-AE50CFC59F1A@microsoft.com...
    > > Hi, I've looked for this but can't find it exactly.
    > >
    > > I need a macro to :
    > > copy 7 specific sheets from one workbook (not the whole book) to a new

    > book
    > > ask the user for a name
    > > save the new book as that name
    > >
    > > Thanks in advance
    > > --
    > > Linda M

    >
    >




  5. #5
    Jef Gorbach
    Guest

    Re: creating new workbook macro


    "Bob Phillips" <phillips@tiscali.co.uk> wrote in message
    news:#FaiKq4WFHA.3584@TK2MSFTNGP14.phx.gbl...
    >
    > Worksheets(Array("Sheet1", "Sheet2","Sheet3",
    > "Sheet4","Sheet5","Sheet6","Sheet7")).Copy
    > ans = inputbox("Name the new workbook"
    > activeworkbook.SaveAs Filename:= "C:\myDir\" & ans & ".xls"
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "LindaM" <LindaM@discussions.microsoft.com> wrote in message
    > news:01247991-7EFA-49F2-A975-AE50CFC59F1A@microsoft.com...
    > > Hi, I've looked for this but can't find it exactly.
    > >
    > > I need a macro to :
    > > copy 7 specific sheets from one workbook (not the whole book) to a new

    > book
    > > ask the user for a name
    > > save the new book as that name
    > >
    > > Thanks in advance
    > > --
    > > Linda M

    >
    >


    Thanks!!
    Had resorted to repeatedly calling a sub-subroutine to process a subgroup of
    sheets until encountering your much more elegant, logical, and faster "With
    Worksheets(array(...))...End With" solution.






+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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