MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Save a file as a cell reference


Posted by Rick M on March 07, 2001 8:06 AM

I would like to always save a file as the contents of a cell within the workbook.
EX: Cell D3 Value= 009-111 (from a lookup)
I would liek the workbook to be saved as 009-111 when closed.
Thanks.


Posted by Gary Greenhat on March 07, 2001 9:13 AM

Hello,
This code should do what you want:-

Sub SaveMe()
Application.ActiveWorkbook.SaveAs Sheets("SheetName").Range("D3").Value
End Sub


Regards,
Gazzer.

Posted by Rick M on March 07, 2001 12:36 PM

Thanks,,,Where do I put this code?


Posted by Gary Greenhat on March 10, 2001 1:01 AM


From within Excel open the VB Editor (Alt+F11), click Insert, Module and paste it in there. You'll then be able to run the macro from within Excel tools menu as per usual.