+ Reply to Thread
Results 1 to 4 of 4

Macro to save document with dynamic location and dynamic name

  1. #1
    Registered User
    Join Date
    11-13-2020
    Location
    london
    MS-Off Ver
    Microsoft 365 Excel
    Posts
    23

    Macro to save document with dynamic location and dynamic name

    Hi all

    Been wracking my brain over this and have tried looking at existing posts and it's still not working for me .

    My goal is to, on a monthly basis, copy sheets from one workbook and take those copies to form a new workbook, saving it a variable file location (ie when I run in September, save in September folder, when I run in October, save in October folder). The file name can change and is dependent on what I write in a cell.


    Dim Path As String

    Dim month As String

    month = Sheets("COMMAND").Range("A1")

    'fyi in cell A1 I have 2023.09.30/Data/Filename. Cell A1 contains a formulae which merges together the 3 components (2023.09.30&/Data/Filename)

    Path = "https:blahblah/Marketing/Sheets/"


    Sheets(Array("Sheet1", "Sheet2")).Copy
    ActiveWorkbook.SaveAs filename:=Path & month
    FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False 'I get a syntax error on this line =S


    Range("C7").Select
    ActiveWindow.Close
    Range("H6").Select


    Any help would be hugely appreciated

    thanks

    angelos
    Last edited by angelos19; 10-31-2023 at 06:59 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to save document with dynamic location and dynamic name

    Hi there,

    Maybe:

    Please Login or Register  to view this content.

    Hope this helps.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    11-13-2020
    Location
    london
    MS-Off Ver
    Microsoft 365 Excel
    Posts
    23

    Re: Macro to save document with dynamic location and dynamic name

    Huge thanks Greg, worked perfectly!!!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to save document with dynamic location and dynamic name

    Hi again,

    Many thanks for your feedback - much appreciated!

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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] Macro to save inputs and link to a dynamic drop down list
    By tml2424 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2020, 12:38 AM
  2. Dynamic Table of Store/Bank with location assignment (Dynamic Inventory)
    By x_ampl1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2017, 01:58 PM
  3. Macro Code to Open file with dynamic name (and possibly re-save with different name)
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2013, 01:40 PM
  4. [SOLVED] VBA to open saved GIF of chart with dynamic save location
    By chiplaidlaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2012, 04:50 AM
  5. Need a dynamic macro to copy number of tables from a sheet in Excel to Word document
    By padashri in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 02:45 AM
  6. Excel 2007 : Dynamic Save Macro help
    By GaidenFocus in forum Excel General
    Replies: 2
    Last Post: 10-12-2010, 05:32 PM
  7. Save "Dynamic" sheet in workbook If cell = . To another location
    By DJarqus in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-20-2008, 12:19 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