+ Reply to Thread
Results 1 to 6 of 6

Save Workbook at End of Month with Macro

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    18

    Save Workbook at End of Month with Macro

    I have a workbook that needs to be archived at the end of every month. I figured trying to create new sheets etc would be more hassle than its worth, so I just created a macro that I assigned to a button that will save the file at the end of the month - I have that part figured out.

    Right now I have the macro saving the current workbook on as "File_LastMonth" - it's all pre-programmed. Is there a way to do it where excel will put it in the actual past month ? IE "File_June2013" ?

    Thanks.

  2. #2
    Registered User
    Join Date
    07-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Save Workbook at End of Month with Macro

    Also, is there a way to keep excel from opening the newly saved file ? I would rather the save "happens in the background" and you never leave the "master" workbook

    Thanks.

  3. #3
    Forum Contributor
    Join Date
    02-28-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    272

    Re: Save Workbook at End of Month with Macro

    Change your save as name coding with this

    Please Login or Register  to view this content.
    Please consider adding a * if I helped

  4. #4
    Registered User
    Join Date
    07-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: Save Workbook at End of Month with Macro

    wfm007,

    That works! Only one minor question:

    This is my coding:

    Please Login or Register  to view this content.
    Which produces "File.xlsm_June2013"

    Is there a way to do it "File_June2013.xlsm"? The way its done now is fine, i can simply rename it.

    Apologies on the simple questions, I know just enough to get me deep into a project and in trouble!

    Thanks.

    - AF

  5. #5
    Registered User
    Join Date
    12-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    11
    Hi! I was looking for a similar macro to save my end of month sheet. Can you please share your VBA code? Thank you!!

  6. #6
    Registered User
    Join Date
    06-07-2016
    Location
    Kent
    MS-Off Ver
    2013
    Posts
    2

    Re: Save Workbook at End of Month with Macro

    This is the code I have used recently to archive files:

    Private Sub CommandButton1_Click()
    CurrentFile = ThisWorkbook.FullName
    Dim sFile As String
    sFile = "FILENAME " & Format(Date, "mmm-yy") & ".xlsm"
    ActiveWorkbook.SaveAs Filename:="FILEPATH" & sFile, FileFormat:=52
    Set ActBook = ActiveWorkbook
    Workbooks.Open CurrentFile
    ActBook.Close
    End Sub

    This also answers your question regarding opening the new file - it will open but this code will close it and return to the "old" document.
    Filename format is "Filename MMM-YY"
    Hope this helps!

+ 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: 9
    Last Post: 06-24-2013, 04:14 PM
  2. [SOLVED] Macro to Save a PDF in folder by month
    By tomisthereason in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2013, 05:06 AM
  3. Save Macro name dependant on month
    By dwilkinson12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2013, 03:55 PM
  4. [SOLVED] macro to save file in current month
    By vivek_work in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2013, 07:07 AM
  5. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM

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