Naming Excel File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know of a way where you can save an Excel file & the filename can be assigned from a cell within the worksheet
I know you can retrieve the filename into a cell, but I wish to go the other way - when we save the file it will use a filename that is in an assigned cell.
 
You need VBA to do it. Add this code to a macro in a general code module

Assuming the value is in cell A1 of Sheet1, you use

ActiveWorkbook.SaveAs Filename:=Worksheets("Sheet1").Range("A1") &".xls"

You could assign the macro to a toolbar button, or run it directly.
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

KINGER said:
Does anyone know of a way where you can save an Excel file & the filename
can be assigned from a cell within the worksheet?
I know you can retrieve the filename into a cell, but I wish to go the
other way - when we save the file it will use a filename that is in an
assigned cell.
 
Back
Top