Auto Refresh Excel Every 1 Second Using VBA in Excel

 

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

img1

 

  • Click on Insert then Module

img2

 

This will create new module.

Enter the following code in the Module

Sub Calculate_Range()

 Range(“A1:A5″).Calculate

 Application.OnTime DateAdd(“s”, 1, Now), “Calculate_Range”

End Sub
img3

 

  • 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

img4

 

In this way we can schedule the excel file to refresh every x amount of time & save.



Example:


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>