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.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,994
Messages
5,834,773
Members
430,320
Latest member
Napzz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top