I am trying to create a macro that auto-saves my excel workbook whenever the value in a specific cell increases by 1.
I have the code for the auto-save whenever the cell changes which I will post below;
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A2")) Is Nothing Then
ThisWorkbook.Save
End If
End Sub
However, I can't seem to adapt the code for the macro to only execute when the value in the cell increases by one. I.e, cell value is 10, only save workbook when the cell value is 11 and so forth.
Thank you.
Edit: The problem has been solved. If anyone is looking for the solution check this post: https://superuser.com/questions/1265717/excel-auto-save-macro
You can use Worksheet_SelectionChange to get old value of cell (Binils's answer), then do appropriate comparison (newval - oldval = 1).