In his post we will see how to write a VBA code to auto save excel file after every nth minute, we can introduce auto save feature in excel file with the help of VBA code and can customize the timing after which it will auto save.
We will write a VBA code to auto save excel every 5 minute, you can customize the formula I the vba code to suit your timing requirement.
Open VB editor from Developer tab in excel as shown in the figure.
Open “ThisWorkbook” module in which we will write a VBA code to save excel file after every 5 minute.
Now double click “ThisWorkbook” module to open that and paste the below code in the module.
Application.DisplayAlerts = False
Application.DisplayAlerts = True
Application.OnTime Now + TimeValue(“00:05:00”), “Save1”
We will take help of TimeValue function to specify the time after which excel should save the file, here we have hour, minutes and seconds and you can see that we have specified 5 minutes in the argument which tells excel to save every 5 minutes.
Hope this helped.