Alarm Sound in Excel

  • Thread starter Thread starter Roy Harrill
  • Start date Start date
R

Roy Harrill

Is there a way I can use conditional formatting or something else to have a
sound (e.g., wav file) play if a value in cell A1 is less than 25? Note:
Cell A1 is an unattended update of a stock or bond value, so it changes
frequently, and I want to hear a sound if the value goes below 25.
 
Roy

Very dependent on hardware and setup, but this will sound 5 beeps (Or theme
noise if you have them set up) at 1 second intervals, when A1 goes below 25
(It will also sound on each change if the value stays below 25). It goes in
the code module behind the worksheet as it is event code.

(See here: http://www.nickhodge.co.uk/vba/vbaimplement.htm#EventCode)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Integer
If Not Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value < 25 Then
For x = 1 To 5
Beep
Application.Wait Now + TimeValue("00:00:01")
Next x
End If
End If
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Back
Top