Vba keep info that macro is running in Excel
For example, I have a macro that takes couple of minutes to execute as it processes voluminous information - sometime it is not clear during waiting if the macro is actually running. Is ther a way for me to get status?
To do it in Excel, here is the answer:
- Option Explicit
- Sub SubRoutineSample()
- Dim i As Long
- For i= 2 to 20000
- Application.StatusBar = "Processing Record " & i
- ' complex
- ' macro
- ' function
- ' goes here
- Next i
- Application.StatusBar = False
- End Sub
a) Line 5 - When execution happens, StatusBar at the bottom left of Excel window is updated with details of record being processed. This information helps ascertain the processing status of macro.
b) Line 11 - To return control of the status bar back to Excel, set its value to FALSE.