I want to use VBA to refresh data in the spreadsheet periodically. I've tried following codes, it refresh the cell A1 every 2 second. However, within these 2 seconds, I can't use the spreadsheet. Even I have used "DoEvents", it can only catch the action I did in the 2 sec, but it still doesn't give me free control on the spreadsheet within the 2 sec. Is there any multi-threading in VBA ? or is there any alternative ? Thanks !
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub main()
Dim x As Integer
For x = 0 To 10
Sleep 2000
DoEvents
Cells(1, 1) = x
Next
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub main()
Dim x As Integer
For x = 0 To 10
Sleep 2000
DoEvents
Cells(1, 1) = x
Next
End Sub