Simulating simple variable functions via cells only?

  • Thread starter Thread starter Joey
  • Start date Start date
J

Joey

Hi. I am running a spreadsheet in which there are some cells that
contain the highest numbers delivered by a DDE data stream. The cells
update only if the current DDE-delivered number is higher than the one
already stored in the cell. In other words, the cells in question
always display the highest value registered during a session.

It's simple enough with VBA variables and loops (and I'm no guru :-).
It works but I have to use a timer (set at 3 seconds) to scan ranges
of cells, and this brings some complications and inefficiencies into a
spreadsheet that is quite big and resources-intensive to start with.
Having to use the timer puts it squarely into the kludge category :-)

With VBA, I compare the current DDE number to the highest previous
number stored in a variable and write it (or not) to the appropriate
cell. What I need is some kind of a conditional update on a cell, as
in:
IF(current DDE number > current number in cell XYZ, write current DDE
number to the cell, otherwise no change).

But it's easier said than done :-)

Any ideas or tips?

Thanks in advance for the help,

Joey
 
Hi
not possible with formulas but you may consider an event procedure. In
your case I would try the following:
- add a formula to your sheet that just references the DDE linked cell
- use the Worksheet_Calculate event to identify cell changes (the
worksheet_change event won't work as it's not triggered by a DDE link)
- within the event procedure I would use a static variable to check if
the linked cell has changed

See:
http://www.cpearson.com/excel/events.htm
 
Hi
not possible with formulas but you may consider an event procedure. In
your case I would try the following:
- add a formula to your sheet that just references the DDE linked cell
- use the Worksheet_Calculate event to identify cell changes (the
worksheet_change event won't work as it's not triggered by a DDE link)
- within the event procedure I would use a static variable to check if
the linked cell has changed

See:
http://www.cpearson.com/excel/events.htm

Thanks a lot for the info and also the link. It's interesting and
certainly worth a look. Maybe a way to make my spreaadsheet less heavy
processing-wise, even it I can't totally rely on a formula-based
solution.

Thanks again: the help is much appreciated.

Joey
 
Back
Top