+ Reply to Thread
Results 1 to 3 of 3

Creating and saving new workbooks from one source

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    25

    Creating and saving new workbooks from one source

    Hi I am pretty new to VBA, I have a spreadsheet that I am using called "FX Master Worksheet.xlsm" - we can just refer to it as the source file going forward. In it there are two worksheets (one called "TDB" and one called "MTS").

    Every day I use the source file and then have to save it as a copy and rename it "Today's FX sheet.xlsx" - we can call it the new file going forward.


    Then I copy the "MTS" worksheet from the new file and save it as a copy as a csv file named "Today's MTS file.csv".


    I am trying to insert VBA code into my existing macro but all I keep doing is renaming the source file instead of the new xlsx or csv files. Can anyone help?

    I will insert my current code and maybe you can tell me what and where I should insert. Stumped! I just want to end up with the source file untouched, and the new xlsx and csv files renamed as above and saved in the location "G:\FX\"

    PS if I didn't notate the code correctly let me know. I don't know code but copied what i could from other sheets I found in similar files and tried to adapt to suit my requirements.




    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Creating and saving new workbooks from one source

    Hi

    You should save your Master workbook as an Excel Template file .xltm. Save it in your default folder for Templates. Then every day you can open the template and when you choose to save it, it will automatically save as a .xlsm file and it won't overwrite your original template.

    Your saving macro seems a little complicated. Why not just use

    Sheets("MTS").Copy

    This will create a new workbook with a single sheet called MTS.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Creating and saving new workbooks from one source

    Thanks Richard, the reason for the additional sheet being created is that I am the user of the sheet primarily, but when others use the sheet they accidentally save over the original, or save over a previously saved file (I overly simplified the instructions above to remove all of the code that isn't pertinent to this discussion - there are other sheets in the original and protection etc that i remove and reformat after creating the new sheets).

    Do you know of any code that could help?

+ 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] Trouble saving a websites source code to a text file.
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2013, 09:11 AM
  2. [SOLVED] Creating New Workbooks From Worksheets in Different Workbooks
    By Panda2000 in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 07-27-2012, 06:53 PM
  3. How to switch between source and 2 new workbooks?
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2010, 01:04 PM
  4. [SOLVED] Display 2 formulas from source workbooks to destination workbooks
    By Excel_seek_help in forum Excel General
    Replies: 4
    Last Post: 04-27-2006, 03:20 PM
  5. [SOLVED] Linking One Source to Two Workbooks
    By LuAnne in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-04-2005, 09:05 PM

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