Have you ever wished that you could add some kind of autosave to your workbook that you control?

While the built in Autosave in MS Excel works most of the time,
there are instances where you want to secure your work yourself.

How can we do this?

We will need to add two pieces of VBA Code to our workbook then we need to save it as a macro enabled workbook.
(find how to do this here.)

The first piece of code

To create the autosave add this code to the This Workbook section:

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:05:00"), "SaveThis"
End Sub

What is this piece code does?
On opening the workbook, it starts a timer of 5 mins
(You can change the intervals of saving by changing the timevalue between the two “)
When the timer ends it calls the macro named SaveThis
(This is the macro we will put in a module)
Essentially this is the timer part of the autosave.
If you want to tweak it, you have to modify the time bit. Just make sure that you keep the time format as above.

Then add this code to a module:
(how to add a module can be found here)

Sub SaveThis()
Application.DisplayAlerts = False
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue("00:05:00"), "SaveThis"
End Sub

What is this piece code does?
When the macro runs, it disables the alerts in excel
(You will not get a popup if you want to overwrite a save or not)
Then it saves the workbook and puts the notifications back.

Then the last line of code is to restart the timer and at the end call itself again. Same again here with the TimeValue. If you want the interval to be longer or shorter you need to adjust the timevalue accordingly.

Also remember that the macro will run at the specified times, you will not notice anything (unless your file is huge in size).
The saving occurs almost immediately.

[et_pb_ccfcm_facebook_comments_module ccfcm_app_id=”339898187197719″ _builder_version=”4.6.1″ _module_preset=”default”][/et_pb_ccfcm_facebook_comments_module]