Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How to save Excel, using macro which takes the name from a cell contained in it?
How to save Excel as, using a macro which takes the name from a cell
contained in it? Actually based on one of the postings here I can see that the following script does the job. ActiveWorkbook.SaveAs Filename:=Range("A1").Value However I am wondering: 1- How can the path (directory/folder) can be incorporated in the above? 2- How the above script can be executed automatically as soon as a name is entered in the "A1" cell for instance? Or even being saved after a specific time or even conditional to an other action? Many thanks for your kind advice. Cheers, Reza. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How to save Excel, using macro which takes the name from a cell contained in it?
Reza,
You could use an event to automatically save the file when a value is entered into cell A1: copy the code below, right-click the sheet tab, and select "View Code" then paste the code in the window that appears. Change the path to reflect the desired path.... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address < "$A$1" Then Exit Sub Application.DisplayAlerts = False ThisWorkbook.SaveAs "C:\Excel\" & Target.Value & ".xls" End Sub HTH, Bernie MS Excel MVP wrote in message ps.com... How to save Excel as, using a macro which takes the name from a cell contained in it? Actually based on one of the postings here I can see that the following script does the job. ActiveWorkbook.SaveAs Filename:=Range("A1").Value However I am wondering: 1- How can the path (directory/folder) can be incorporated in the above? 2- How the above script can be executed automatically as soon as a name is entered in the "A1" cell for instance? Or even being saved after a specific time or even conditional to an other action? Many thanks for your kind advice. Cheers, Reza. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
copy excel cell to cell in word table using excel macro | Excel Discussion (Misc queries) | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
Row Expansion | Excel Worksheet Functions | |||
Possible Lookup Table | Excel Worksheet Functions |