Hi,
I'm trying to get a bit of code to name a file as the prior month. I searching this forum and many others, as well as excel help, and even asked our traning department in work, all to no avail.
Does anyone know how I can get this to work?
This is what I have:
Sub save()
Dim myPath As String, lastday As String
myPath = ActiveWorkbook.Path
'lastday need to be the end of the prior month in yyyymmdd format, so far only saves as current date in yyyymmdd format (need to work for year end as well)
lastday = Format(Now(), "yyyy") & Format(Now(), "mm") & Format(Now(), "dd")
'which could be lastday = Format(Now(), "yyyymmdd") I know, but I was working on trying to get it to work.
ActiveWorkbook.SaveAs Filename:= _
myPath & "\Final_RP_Barra_Preprocessor_TEST " & lastday & ".xls"
End Sub
Cheers
Bookmarks