MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Saving a file using 2 cells as filename

Posted by Tony on August 23, 2001 1:51 AM

I want to create a macro that will save the file as a number as referenced in cell B1, followed by a name in cell B2. How can I do This?
I would also like to be able to create a macro that will save a name and the quote number to a seperate spreadsheet. This spreadsheet would act as a database of names in cells next to the quote numbers.
I am trying to grasp the basics of creating macros and would appreciate any help.

Posted by Andrew on August 23, 2001 4:00 AM

Put this formula into cell B3 CONCATENATE(B1,B2).

Use the following macro which will save the file according to the contents of cell B3.

ThisFile = Range("B3").Value
ActiveWorkbook.SaveAs Filename:=Thisfile

This does not save the name automatically (ie when you press save), it saves it only once the macro has been run. You could create a command button on the spreadsheet and rename it as "Save", then assign the above macro to it. Each time you click the command button it runs the macro and saves your file.