«Back

Excel: Macro for automatically saving filename with date
Posted by TJ on Wednesday August 29, 2007 @ 10:04 AM
[Tags: excel, hints, internet]



I use the following macro to save my timesheet using the filename and path in cell "A1"(ie:C:datafilename.xls).

You can also include today's date using concatenate by including the following in Cell A1
=CONCATENATE("c:datafilename_",MONTH(NOW()),"-",DAY(NOW()),"-",YEAR(NOW()),".xls")
Of course you can replace cell A1 in the following code with any cell you want as long as it contains a valid filename and path.
Sub 
savefile()
' SaveFile Macro
' Macro recorded 4/16/2007 by tmiller of tjshome.com
'save a copy of current spreadheet using filename in cell 'TimeFile'
TimeFile = Range("A1").Value
ActiveWorkbook.SaveAs Filename:=TimeFile, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _, CreateBackup:=False
End Sub



Reader Comments (Page 1 of 1) 1 |
Post a Comment:
Comment:
Name:
Security Code Security Code:
Comments with offensive language will be automatically deleted within 24 hours.