I would like some help to understand why the function doSomething is not running.
Calculation mode is on Automatic
Sub Test()
check = 0
Debug.Print "Timer_1: " & Now()
Call runFromNow("doSomething", "00:00:05")
Do While check = 0
DoEvents
Loop
Debug.Print "Timer_2: " & Now()
End Sub
Sub runFromNow(myProcedure As String, Optional myTime As Variant = "00:00:15")
If myProcedure <> "" Then
Application.OnTime Now + TimeValue(myTime), myProcedure
Debug.Print "runFromNow: Activated at " & Now + TimeValue(myTime)
End If
End Sub
Sub doSomething()
check = 1
End Sub
checkinto a global variable. Right now it doesn't work because thecheckinsideTest()is not the samecheckthat is updated indoSomething()- Marcucciboy2Option Explicitto avoid such issues. This would force you to declarechecka second time if it is not declared public. And so you would immediately see that it was only declared private. Especially for beginnersOption Explicitforces you to write better code. - Pᴇʜ