View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter Rooney Peter Rooney is offline
external usenet poster
 
Posts: 325
Default "save as" macro help

Hi, Dyl,

How about this as an example:

Foldername is a cell on the worksheet containing the folder that you want to
save to.
WeekNumber is a cell containing the week number
Year is a cell containing the year

Sub SaveMe() '[Control]+[Shift]+V

Application.DisplayAlerts = False
Set WeekNumber = Sheets("Database").Range("WeekNumber")
Set Year = Sheets("Database").Range("Year")
FolderName = Sheets("Database").Range("FolderName").Value
SaveString = Year.Value & "-" & _
Format(WeekNumber.Value, "00") & " " & "Consolidation.xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

This code saves the active workbook in the format 2005-42 Consolidation.xls
where the 2005 and 42 come from cells in the worksheet.
I'm sure you can adapt this to your requirements.

Regards

Pete



"dyl" wrote:


I want to create a macro that has "save as" in it and automatically
fills in the new file name by looking at the contents of a specific
cell in the file.
Is this possible?


--
dyl
------------------------------------------------------------------------
dyl's Profile: http://www.excelforum.com/member.php...o&userid=28671
View this thread: http://www.excelforum.com/showthread...hreadid=483455