![]() |
Basic VBA Question
How do I make my macro save my spreadsheet when I run it?
|
Basic VBA Question
Sub savethesheet()
ActiveWorkbook.SaveAs Filename:="D:\myfiles\Book1.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False End Sub Use this code. Obviously change the path of where you want to save it and the name that you wish to save it as. The way I learned to do these little things was to record a macro while I was doing what I wanted it to do. Which is what I did here - set a macro recording then saved my sheet. Then you can see the code it creates. |
Basic VBA Question
Thanks.
keri wrote: Sub savethesheet() ActiveWorkbook.SaveAs Filename:="D:\myfiles\Book1.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False End Sub Use this code. Obviously change the path of where you want to save it and the name that you wish to save it as. The way I learned to do these little things was to record a macro while I was doing what I wanted it to do. Which is what I did here - set a macro recording then saved my sheet. Then you can see the code it creates. |
All times are GMT +1. The time now is 10:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com