How can I force my own crude "auto-recalculate" while working in an otherwise manual-recalc state?

d0rian

Active Member
Joined
May 30, 2015
Messages
313
Office Version
  1. 365
I pull in thousands of lines of real-time / tick-by-tick stock option data via my brokerage's RTD server, and I then run a bunch of formulas / calculations on all of the data I pull in (some of them resource-intensive, like real-time ranking, INDEX lookups on a table of 4,000+ rows, etc, though I've made a point to avoid array or dynamic formulas which I'm told are resource-hogs). This results in a performance lag rendering my book largely unusable.

For example: when I populate a new workbook with ONLY the RTD formulas, all of the cells update very promptly (at least once / second). However in my workbook with all of the ancillary formulas and calculations, cells can take 45-seconds or more to update after a value changes in the brokerage's software window, rendering it un-usable for live trading.

But I got an interesting suggestion: if it's the auto-calculation resulting from every new tick (of which there are hundreds coming in every second) that's causing the lag, maybe I can set my workbook to MANUAL calculation, and simply emulate auto-calc by forcing a recalc at a prescribed interval (maybe once / second). How would I accomplish that?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I avoid VBA as a policy, but I have one workbook similar to yours that uses the following code to update every 1 second. Alter the code to two seconds, or half-second or whatever you fancy. Put a s button in the workbook to START the macro and another to STOP it.

Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Public whn As Double
 Public Const T = 1 ' ONE second
 Public Const macroo = "refresh" ' the name of the procedure to run[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] Sub refresh()
 Application.ActiveSheet.Calculate
 StartTimer
 End Sub[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
 Sub StartTimer()
 whn = Now + TimeSerial(0, 0, T)
 Application.OnTime EarliestTime:=whn, Procedure:=macroo, Schedule:=True
 End Sub[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
 Sub StopTimer()
 On Error Resume Next
 Application.OnTime EarliestTime:=whn, Procedure:=macroo, Schedule:=False
 End Sub[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif][/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top