In this article, you will learn how to auto refresh excel file every 1 second using VBA code.
Question): In column A there are some values stored & I want them to automatically refresh every 1 second.
To refresh excel file every 1 second we will follow the below steps:
- In Range A1:A10; use RAND function
- We need to follow the below steps to launch VB editor
- Click on Developer tab
- From Code group select Visual Basic
- Click on Insert then Module
This will create new module.
Enter the following code in the Module
Application.OnTime DateAdd(“s”, 1, Now), “Calculate_Range”
- The above code has used the code application.ontime which is used to auto calculate the range A1:A5 to refresh every 1 second.
- Range A1:A5 contains RAND function which will keep on updating after every 1 second
In this way we can schedule the excel file to refresh every x amount of time & save.