=Alarm(A1,">=1000")
The sound will play when the value in cell A1 is greater than or equal to 1,000.
=Alarm(C12,"<0")
The sound will play when the value in cell C12 is negative.
OR VBA EXAMPLE:
'Windows API function declaration
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Function Alarm(Cell, Condition)
Dim WAVFile As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
On Error GoTo ErrHandler
If Evaluate(Cell.Value & Condition) Then
WAVFile = ThisWorkbook.Path & "sound.wav" 'Edit this statement
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
Alarm = True
Exit Function
End If
ErrHandler:
Alarm = False
End Function
If you do not change the path of the sound file, it will just use a default sound. The program will first look for the file in the same path as the workbook, if not there, default sound will play. Unless you put the correct path if the sound is somewhere else.
Enjoy.