ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel 2003 - A macro to exit excel (https://www.excelbanter.com/excel-worksheet-functions/253721-excel-2003-macro-exit-excel.html)

Alan_Malawi

Excel 2003 - A macro to exit excel
 
Hi I need to create a macro that will first do a "save as" picking up a file
name from a cell on the worksheet and then will exit excel

David Billigmeier

Excel 2003 - A macro to exit excel
 
Chage the reference of [a1] to the cell on your worksheet that has the name
you want to save as:

Sub SaveAndClose()
ActiveWorkbook.SaveAs Filename:= _
"C:\myDirectory\" & [a1] & ".xls"
ActiveWorkbook.Close
End Sub



--
Regards,
Dave


"Alan_Malawi" wrote:

Hi I need to create a macro that will first do a "save as" picking up a file
name from a cell on the worksheet and then will exit excel



All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com