I get streaming stock quotes via DDE that update every 5 seconds. I just discovered how to use VBA and get Excel to play a WAV sound file when the value of a cell meets a condition, BUT I only want the sound to play when the cell value goes from being in a state of NOT meeting the condition to meeting it.
E.g. A stock is trading at $5.10, and I want the sound to play whenever the stock prices drops BENEATH $5.00. My first attempt resulted in the sound playing continuously when the price is < $5.00 (because the quotes auto-update every 5s, which "updates" the value of a cell and plays the sound every time, which is really annoying). So I want to restrict the sound to ONLY play when the price goes from $5 or higher to $4.99 or below. To be clear, I don't mean a one-time-only sound. I want it play EVERY time the value goes from being $5 or above to being below $5. e.g. if every 5 seconds, the streaming quotes that populate cell A1 are:
- $5.10 (no sound)
- $5.00 (no sound)
- $4.99 (sound)
- $4.95 (no sound)
- $4.99 (no sound)
- $5.03 (no sound)
- $4.95 (sound)
E.g. A stock is trading at $5.10, and I want the sound to play whenever the stock prices drops BENEATH $5.00. My first attempt resulted in the sound playing continuously when the price is < $5.00 (because the quotes auto-update every 5s, which "updates" the value of a cell and plays the sound every time, which is really annoying). So I want to restrict the sound to ONLY play when the price goes from $5 or higher to $4.99 or below. To be clear, I don't mean a one-time-only sound. I want it play EVERY time the value goes from being $5 or above to being below $5. e.g. if every 5 seconds, the streaming quotes that populate cell A1 are:
- $5.10 (no sound)
- $5.00 (no sound)
- $4.99 (sound)
- $4.95 (no sound)
- $4.99 (no sound)
- $5.03 (no sound)
- $4.95 (sound)