I have an excel spreadsheet with a streaming temperatures data in a multiple cells.
I'm trying to create a user defined function that would sound an alarm when a temperature rises above specified value.This value is a parameter of this function.
So far I have this code...
Function BeepOnce(rng As Range, alarm_temperature As Single = 50)
If (rng.Cells.Value >= alarm_temperature) Then
BeepOnce = "Temperature is above specified vaule!"
Beep
Exit Function
End If
End Function
The problem is that I need to sound an alarm only once for every cell. Only when temperature rise above this value.
example:
temperature 1 in a cell A1 is 50. Once the temperature in a cell A1 rises above 60 (for example to 65) an alarm would sound(only once). When the temperature then rises again to (for example to 70), there would be no alarm.
temperature 2 in a cell A2 is 40 Once the temperature in a cell A2 rises above 50 (for example to 55) an alarm would sound(only once). When the temperature then rises again to (for example to 60), there would be no alarm.
Once the temperature decrease below specified value, alarm then rest itself.
I'm trying to create a user defined function that would sound an alarm when a temperature rises above specified value.This value is a parameter of this function.
So far I have this code...
Function BeepOnce(rng As Range, alarm_temperature As Single = 50)
If (rng.Cells.Value >= alarm_temperature) Then
BeepOnce = "Temperature is above specified vaule!"
Beep
Exit Function
End If
End Function
The problem is that I need to sound an alarm only once for every cell. Only when temperature rise above this value.
example:
temperature 1 in a cell A1 is 50. Once the temperature in a cell A1 rises above 60 (for example to 65) an alarm would sound(only once). When the temperature then rises again to (for example to 70), there would be no alarm.
temperature 2 in a cell A2 is 40 Once the temperature in a cell A2 rises above 50 (for example to 55) an alarm would sound(only once). When the temperature then rises again to (for example to 60), there would be no alarm.
Once the temperature decrease below specified value, alarm then rest itself.