File Save As Use in Macro

  • Thread starter Thread starter JTfisher
  • Start date Start date
J

JTfisher

Does anyone know of a macro that will reference the contents of a cell and
the save the file with the contents of that cell? For instance,

Cell A1 contains the name John
When the macro is run it will save the file as John.xls.

Any help would be appreciated.

Thanks,

James Hardeman
 
James

Try this one

Sub SaveCellName()
Dim FileName As String

FileName = Range("A1").Value

ActiveWorkbook.SaveAs FileName:=FileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

Personally I would add the path name in as well when creating the
FileName

e.g. FileName = "C:\MY DOCUMENTS\Excel\"&Range("A1").Value

David P
 
Back
Top