Link to home
Start Free TrialLog in
Avatar of Bright01
Bright01Flag for United States of America

asked on

Automatic refresh function by interval

EE Pros,

I'm doing testing on what needs to appear as "real time data" and statistics on different Sensors.  I need to start out easy on this so I have attached a spreadsheet that has a Column E that needs to be refreshed at a particular frequency (in seconds) -- perhaps set up as a simple looping exercise.  So when the sheet is open, it will automatically fire off the function to randomly produce new data at the frequency specificed.

Also, this change in the function should not update any other =randbetween( , ) calculations.
C--Data-Temp-Date-Time-Calculation.xls
Avatar of FamousMortimer
FamousMortimer
Flag of United States of America image

Hi,

Does this work for you?  You can change the code in TheSub to whatever you need it to do and change the variable cRunIntervalSeconds to the interval in number of seconds you want it to run.  Right now I just set it to calculate the activesheet which will recalc your random functions
Avatar of Bitsqueezer
Hi,

that can't be done with a function but you can use the "Workbook Open" event to start a timer using the "Application.OnTime" method (see Excel help for further details).

With this you can specify a VBA procedure which updates the wanted cell(s) to the wanted values at the given time and then it only needs to use the Application.OnTime method again to set the next interval (Now() plus 5 seconds).

Of course you would need to save the file as macro enabled file.

Cheers,

Christian
Avatar of Bright01

ASKER

FamousMortimer,

I downloaded the WS but there is no Sub.

B.
ASKER CERTIFIED SOLUTION
Avatar of FamousMortimer
FamousMortimer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
FamousMortimer,

Thank you!  Great work!

B.
You are very welcome.  Glad to help and thanks for the grade!
I'm posting a version 2 request.  Hope you will pick it up!

B.