+ Reply to Thread
Results 1 to 3 of 3

Create new workbook based on sheet

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    161

    Create new workbook based on sheet

    Hi all,

    I've created macro that from the main document (Order generator) will create new workbook (Order Document). The steps for this are the following:

    1. Unhide the "Order Document-template" sheet from the "Order generator" file.
    2. Copy the "Order Document-template" sheet in new workbook.
    3. Change name of new "Order Document-template" sheet in the new workbook to "Order Document".
    3. Change the name of the new workbook to "Order Document".
    4. Hardcode (copy/past) the data (the whole sheet) in the new workbook
    5. Display message: "Order Document will be saved on your computer."
    6. Delete the rows in the "Order Document" sheet if the value in column G is 0.
    7. User defined where the new workbook to be saved.
    8. Delete column G in the "Order Document".


    I need to make changes to the macro, so it will hide the "Order Document-template" sheet in the "Order generator" workbook, at the end of the macro.
    Also, I need the macro to have the flexibility and work even if the name of the "Order generator" workbook is changed.

    Thank you in advance.

    Igor

    Order generator.xlsb

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Create new workbook based on sheet

    You don't need step 1, you can copy a worksheet without unhiding it.

    As for the second part I don't see where you refer to the 'Order generator' workbook in the code, but if you do need to you can use ThisWorkbook instead of using Workbooks(workbookname).
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    161

    Re: Create new workbook based on sheet

    Hi Norie,

    I've change in the last part of the code to ThisWorkbook instead of ActiveWorkbook and it worked.

    'hide template sheet
    ThisWorkbook.Sheets("Order Document-template").Visible = xlSheetVeryHidden



    Thank you a lot.

    Igor

+ 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. Replies: 3
    Last Post: 10-01-2014, 01:49 PM
  2. Replies: 1
    Last Post: 07-17-2014, 12:06 PM
  3. Replies: 1
    Last Post: 12-03-2013, 04:19 AM
  4. [SOLVED] copy active sheet, create new workbook, name new workbook based on cell reference
    By jm0392 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2012, 07:12 PM
  5. Replies: 2
    Last Post: 01-13-2012, 04:59 PM
  6. Create multiple sheets in new workbook based on credentials in source workbook
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-07-2011, 10:31 AM
  7. Replies: 1
    Last Post: 11-18-2009, 08:12 AM

Tags for this Thread

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