1

In Calc, I'd like to trigger an event when a specific cell becomes the active cell. I see no way to do that.

Here's the situation:

After entering a payment in a specific cell (say A5) and hitting enter, I'd like to programatically put the current time in the cell immediately below it (A6) - the new active cell. I'd like to detect leaving that cell (A6) or entering the cell below (A7) without modifying the contents of A6 or A7.

I want to use the elapsed time between the enter keystrokes to change the way the sheet reacts.

$10 (enter) (immediate enter) Signals that the transaction is over.

$10 (enter) (wait a second) (enter) Signals the transaction isn't over.

The time difference between the double enter keystrokes determines what happens next.

This spreadsheet has 6600 lines of macro code that makes it function, and I'm already relying heavily on event handling, but it only works on a modified cell. In this case, I'm not modifying A6 or A7, but I want to trigger an event that lets me know they have become the active cells.

Bill Gradwohl
  • 385
  • 4
  • 18
  • Can your macro be triggered by the modification to A5? This could activate a listener for the Enter keystrokes and react accordingly. – Lyrl Dec 02 '15 at 20:50
  • Long story, but no. I'm not even providing all the details as it gets way too complicated to explain here. This is for a high volume sandwich shop and the calc user potentially has to look at the screen after the $10 is entered to see how much change to make. It's only if the operator has done the change calculation in his head that a quick enter enter would terminate the xaction. The enter/enter sequence can occur (in this contrived example) in A6/A7 but in actualit maybe also in A7/A8 - long story. – Bill Gradwohl Dec 03 '15 at 00:44
  • Possibly not something you'd want to do as you've already put so much effort into this setup, but... it's almost certain the final product would be more streamlined if you used OpenOffice Base as the data manager instead of Calc. You could still have Calc be the user interface by creating a Calc file "standalone form" (see https://forum.openoffice.org/en/forum/viewtopic.php?f=83&t=40493) – Lyrl Dec 03 '15 at 14:07
  • I gave up on Base a long time ago. Then tried it again a few months back and nothing but problems. Documented them, sent them up as bugs and as usual, nothing happens to fix them. Base? No Thank You! – Bill Gradwohl Dec 03 '15 at 18:13

1 Answers1

0

There is an example of a Calc selection changed event handler here:

http://www.pitonyak.org/OOME_3_0.odt

For example, search for "Start listening for selection change events."

I would expect this to do what you want. That said, I consider listeners fragile.

Andrew
  • 816
  • 7
  • 15