Reputation: 23
I have a cell in excel that increases randomly through the day. This is an API from my trading platform which counts the total number of trades a day.
What I need to do is the following:
Build an IF statement that each time this cell value increases it plays a sound. I have the sound part covered with a Macro I found online. But the IF statement is giving me trouble.
Anyone could help me out?
Upvotes: 2
Views: 328
Reputation: 10139
You can try using the Calculate()
event, depending on how the update occurs this may work for you. This needs to be placed in the worksheet's code module - NOT a standard module.
Option Explicit
Private priorVal As Currency
Private Sub Worksheet_Calculate()
Rem Change this range to be the range that needs to be looked at
If Range("A1") <> priorVal Then
Beep
priorVal = Range("A1")
End If
End Sub
Upvotes: 4