worksheet change vs calculate for DDE Excel (trading system)

travmont

New Member
Joined
Feb 8, 2006
Messages
4
Summary of problem:
"worksheet_change" doesn't acknowledge changes in my cells that get their data from a broker through DDE. They told me "worksheet_calculate" could do the job, but how and what else may work?


Details:

I have developed an excel sheet that takes live data from the broker and uses it to calculate Support and Resistance on two cells, which should change as the data from the broker changes.

In order to calculate Support and Resistance (D2 and D4) my sheet uses C2 and C4 (today's High & Low) and I thought I told my vb code (through worksheet_change) that if it saw any changes in those two cells within the time C3 (US market open, CET), it would have to change D2 and D4, automatically.

It does it only if I paste different values on C2 and C4 - not if such values get changed by the source live data (from Interactive Brokers). How do I make the sheet react to the data changing other than by pasting it each time on the cell?

Other system traders told me that "worksheet_change" doesn't do the job, and that "worksheet_calculate" would do it, except that I don't know exactly how.

I posted the file here in case anyone wants to help me modify it:

http://www.elitetrader.com/vb/showthread.php?s=&postid=975544
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Problem Solved

It is a miracle! I had the right answer from a friend on an Italian forum. This time it seems to work perfectly. If you add to the top of my file this code, then everything works and it doesn't freeze:

Dim valori(1) As Double

Private Sub Worksheet_Calculate()
On Error Resume Next

If Cells(2, 3).Value + Cells(4, 3).Value = valori(0) + valori(1) Then Exit Sub
valori(0) = Cells(2, 3).Value
valori(1) = Cells(4, 3).Value

---------

Essentially, this code tells the sub routine "calculation" to not calculate unless there are changes on those two famous cells.
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

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