Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
copy excel cell to cell in word table using excel macro jthurnwps Excel Discussion (Misc queries) 0 July 21st 06 07:11 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Row Expansion Susan Excel Worksheet Functions 11 February 28th 06 07:15 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM


All times are GMT +1. The time now is 01:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"