hello guys i am wondering if any of you could explain what this code do and how it works.
Code:
Private Sub Workbook_Open()
lastSelectionChange = Now
closeWB
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
lastSelectionChange = Now
'MsgBox (Now)
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
lastSelectionChange = Now
'MsgBox (Now)
End Sub
Module 1
Public lastSelectionChange As Date
Sub closeWB() // sluit workbook
If DateDiff("n", lastSelectionChange, Now) > 5 Then
ThisWorkbook.Close SaveChanges:=True
Else
Application.OnTime Now + TimeSerial(0, 1, 0), "closeWb"
End If
End Sub
I am kinda new and wonder how this works . like what is a function or what value's do they have.
Kind regards