We help IT Professionals succeed at work.

Automatic refresh function by interval

Bright01
Bright01 asked
on
124 Views
Last Modified: 2014-08-21
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
Comment
Watch Question

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
CERTIFIED EXPERT

Commented:
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

Author

Commented:
FamousMortimer,

I downloaded the WS but there is no Sub.

B.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
FamousMortimer,

Thank you!  Great work!

B.
You are very welcome.  Glad to help and thanks for the grade!

Author

Commented:
I'm posting a version 2 request.  Hope you will pick it up!

B.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.