Hello,
I am working on a project in Excel 2010 that will automatically save a file using a specific naming protocol, based off the dates included on the spreadsheet.
Right now, I have the following code working perfectly for today's date
Now, what I'm hoping to do, is to include logic that if a certain cell [say B3 for this example] contains a date that is not equal to today's date, to instead name the file as "[date in referenced cell] As Of Trades - Bank.xlsx"
Simplifying matters is that the source report will never co-mingle data from multiple dates, so it will really be an either/or situation in terms of the file naming protocol.
I've searched high and low and haven't had much success finding any resource on conditional save-as functions. Is this even possible in excel vba?
Thank a million!
Mike
I am working on a project in Excel 2010 that will automatically save a file using a specific naming protocol, based off the dates included on the spreadsheet.
Right now, I have the following code working perfectly for today's date
Code:
Sub Save()
Dim dtDate As Date
dtDate = Date
Dim strFile As String
strFile = "H:\Trade Files\" & Format(dtDate, "mm-dd") & " " & "Bank" & ".xlsx"
ActiveWorkbook.SaveAs Filename:=strFile, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = False
Now, what I'm hoping to do, is to include logic that if a certain cell [say B3 for this example] contains a date that is not equal to today's date, to instead name the file as "[date in referenced cell] As Of Trades - Bank.xlsx"
Simplifying matters is that the source report will never co-mingle data from multiple dates, so it will really be an either/or situation in terms of the file naming protocol.
I've searched high and low and haven't had much success finding any resource on conditional save-as functions. Is this even possible in excel vba?
Thank a million!
Mike