PDA

View Full Version : SaveAs Date Minus One Month



jsauriol
12-11-2007, 01:54 PM
I have this huge file of coding that I've worked on for a while and for some reason I can't think of the way that you would code a SaveAs forumla that saves as last month. This is a month end report so I am calculating totals for last month.

ActiveWorkbook.SaveAs Filename:="K:\Reports\Monthly\IRV Production\IRV Production " & Format(Now(), "mm-yyyy") & " Final.xls", FileFormat:=xlNormal

Bob Phillips
12-11-2007, 02:04 PM
Format(dateserial(year(date),month(date)-1,day(date)), "mm-yyyy")

jsauriol
12-11-2007, 02:08 PM
Muchas Gracias!!

Bob Phillips
12-11-2007, 02:11 PM
On second thoughts, because you are not interested in the day, you can just use



Format(date-day(date), "mm-yyyy")

mdmackillop
12-11-2007, 02:12 PM
Dim Dte
Dte = Format(Month(Date) - 1, "00") & "-" & Format(Date, "yy")
ActiveWorkbook.SaveAs Filename:="K:\Reports\Monthly\IRV Production\IRV Production " _
& Dte & " Final.xls", FileFormat:=xlNormal