Loading Page...
«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

More




Post a Comment:
Name:
Comment:
Security Code:
Comments with offensive language will be automatically deleted within 24 hours.


Copyright ©1999-2008 Tjshome.com.  All rights reserved.