The natural way to do this is to use the Application.OnTimer method, but it has the “editing problem” that you just noted. The called function will not be executed until the user leaves the editing mode.
You can overcome this: this solution is not very efficient, but you can take control of the macro and return it from the timer (or any other event that you choose).
Excel.
( ), .
Sub a()
Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to fire update in 1000 secs", 4)) = vbYes Then
PauseTime = 1000 ' Set duration 1000 secs or whatever.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes - THIS IS THE TRICK
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds" 'Program your update HERE
Else
End
End If
End Sub
, , .
, , , .
, , .