+ Reply to Thread
Results 1 to 6 of 6

Create new workbook named for Cell in original workbook and copy some sheets from original

  1. #1
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Create new workbook named for Cell in original workbook and copy some sheets from original

    Good Day Experts

    I need a bit of help with my code please.

    I have a workbook that will serve as a master workbook which i need to have a button in that the user can press to create a new workbook with name based on
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    needs to be created in the new workbook with all data from the original workbook in, but formulas removed.

    The code i have below(modified from code found on the web....thanks to the original creator if you see this ), does all that, but the sheets created in the new workbook comes out blank. What am i missing?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! A demonstration …


    … as a starter :

    PHP Code: 
    Sub Demo()
            
    Dim Ws As Worksheet
            Application
    .ScreenUpdating False
            Worksheets
    ([{"NEW MASTER ORDER FORM","Item Qty Pivot","Employee Deduction Pivot"}]).Copy
        With ActiveWorkbook
            
    For Each Ws In .Worksheets
                With Ws
    .UsedRange
                    
    .Formula = .Value
                End With
            Next
                
    .SaveAs ThisWorkbook.Path Application.PathSeparator & .Sheets("NEW MASTER ORDER FORM").[F2].Text
        End With
            Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Create new workbook named for Cell in original workbook and copy some sheets from orig

    Works like a bomb.

    Thank you very much Mark.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Create new workbook named for Cell in original workbook and copy some sheets from orig

    Quote Originally Posted by ANDREAAS View Post
    Thank you very much Marc.
    Thanks for the rep' !

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,673

    Re: Create new workbook named for Cell in original workbook and copy some sheets from orig

    I know it's solved already, but looking at your original code, you were pretty close.
    The issue was: you were activating destination workbook before copying. So the active sheet was not the one you activated just before (in source), but one in the destination workbook. And of course this workbook has been created just a moment before and the sheet to be copied was empty.

    So the minor correction:
    Please Login or Register  to view this content.
    Last edited by Kaper; 05-24-2019 at 05:23 AM.
    Best Regards,

    Kaper

  6. #6
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Create new workbook named for Cell in original workbook and copy some sheets from orig

    thank you...very helpful

+ 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. [SOLVED] Need VBA to create new Workbook and name it based on cell value in original file
    By YukonSoDank in forum Excel Programming / VBA / Macros
    Replies: 65
    Last Post: 06-08-2019, 02:47 PM
  2. open worksheet in a different workbook based on cell name in original workbook
    By thara95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2017, 07:38 AM
  3. Replies: 1
    Last Post: 07-17-2014, 12:06 PM
  4. Copy graph to new workbook while leaving data in original workbook
    By smjpl in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-10-2012, 12:49 PM
  5. Saving workbook as notepad using cell data for filename & retaining original workbook name
    By peterkerr_13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 08:07 AM
  6. Replies: 1
    Last Post: 04-01-2006, 03:50 PM
  7. [SOLVED] Copy tabs(sheets) from workbook without link to original source
    By Rich Ulichny in forum Excel General
    Replies: 3
    Last Post: 08-24-2005, 09:11 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