Adding an autosave option to my current macro

Muke

New member
Joined
Aug 12, 2012
Messages
28
Reaction score
0
Points
0
Hi there. I have a spreadsheet which is available to all staff at my office on which we log issues. It's a fairly simple form and through help from the good people here, I have managed to add buttons to push the data onto a second hidden worksheet, to avoid any accidental errors, and also another button to clear the data from the first form.
The issue I'm having is that people appear to be forgetting to save the spreadsheet when they close it and we are therefore losing their updates. I have found a macro (I think that's the right term) online which professes to autosave the excel worksheet when it is closed, but for the life of me I cannot get it to work. Could anyone please tell me if there is something wrong with it and if not, where I should put it to ensure that we have an autosave on closing. The 'macro' is below

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub
Thanks in advance.
 
It depends where you have placed it.

Personally I would just add

Code:
ThisWorkBook.Save

to the end of your existing code
 
That works a treat, thank-you so much for the help.
 
Back
Top