+ Reply to Thread
Results 1 to 7 of 7

Auto-generate new weekly workbook based on a saved template

  1. #1
    Registered User
    Join Date
    05-30-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Smile Auto-generate new weekly workbook based on a saved template

    Hi,

    I would really grateful if someone could help with the issue I am having with Excel 07.

    I have created and saved a template in excel 07 that contains macros for sorting data, and vlookups for analysing the data. This data is added daily.

    The template has 5 tabs for data for each day of the week, and a sixth tab for analysing that weekly data.

    Is there a bit of code that could be added to the template that auto-generates a new workbook based on the above each week, with all the macros etc in template, minus the data.

    If someone could advise how that is possible it would be much appreciated.

    thanks,

    James

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Auto-generate new weekly workbook based on a saved template

    James,

    Welcome to the forum.

    What you're requesting can be accomplished, the code would just need to know what fields need clearing, where to save the new workbook (if different from the current workbook's folder) and what to name the new workbook. The code would look something like this:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

  3. #3
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Auto-generate new weekly workbook based on a saved template

    an easier way to erase you old data would be to name your data range for each sheets and perform a ClearContents for each of those ranges.
    You can manage to create a dynamic range name that expand with the data you input.

    that would replace the first part of the macro suggested by Tiger.

    The rest of the macro Tiger wrote is still valid.
    Pierre

    Please Login or Register  to view this content.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Auto-generate new weekly workbook based on a saved template

    an even simpler solution is to keep a BLANK workbook in a directory and open it each time you need to start a new week. Don't forget to change the name of the file the first time you save it. You could protect the BLANK workbook so you wont mess with it or make it read only. This will force you to save it with a new name.
    Pierre

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Auto-generate new weekly workbook based on a saved template

    The easiest way would be to create a proper Excel Template(*.xltm). See

    Excel templates
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    05-30-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Auto-generate new weekly workbook based on a saved template

    Guys,

    thanks so much for your help, I wasnt expecting such a speedy response, much appreciated.

    James

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Auto-generate new weekly workbook based on a saved template

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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