Saving spreadsheet based on cell information

proof

Board Regular
Joined
Nov 18, 2005
Messages
53
I have a manual order form which I use to take customer orders, and I would like to be able to save the file soley based on the customers name which resides in a single cell.

In otherwords, cell C1 contains the name John Smith, so when I hit save, it automatically saves the file names as John Smith.xls

Is this possible? If not, that would be a nice feature for Microsoft to add, in my humble opinion.

Thanks for reading.
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

It's absolutely possible:

<font face=tahoma><SPAN style="color:#00007F">Sub</SPAN> NewSave()
    ActiveWorkbook.SaveAs ActiveWorkbook.Path & Range("C1") & ".xls"
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

To use it, hit ALT+F11 to open the VBE (Visual Basic Editor), then goto Insert-->Module. Paste the code in the module window that opens on the right. Then exit back to Excel (ALT+Q).

You can then draw a Button from the Forms toolbar and once drawn, when the "Assign Macro" dialog comes up, select "NewSave".

Hope that helps,

Smitty
 

proof

Board Regular
Joined
Nov 18, 2005
Messages
53
I did not design this spreadsheet, but the cell is actully R7C5.

What would be the code for that.

I assume it means Row 7 cell 5, but I tried inserting that inplace of C5 and it didn't work.

Thanks for the help.
 

proof

Board Regular
Joined
Nov 18, 2005
Messages
53
I got that part now, but what about saving to a certain directory?
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
C5 would be Cells(5,3). R7C5 is E7.

To add the directory and Path, replace ActiveWorkbook.Path with the dir & path. Like "C:\Documents and Settings\Desktop"...

Smitty
 

Watch MrExcel Video

Forum statistics

Threads
1,118,056
Messages
5,569,951
Members
412,299
Latest member
agentless
Top