Alarm

T

Tomas

Could someone help me, please?

Is there any function in excel which would be able to play some sound alarm
if the value in selected cell is for example higher than 10?

Thanks in advance

Jiri
 
L

L. Howard Kittle

Try this in the sheet module. Not sure where I got it, I did not write it,
I just made small adjustments to it.. Change Range(A5) and cell value to
suit.

Private Declare Function Beep Lib _
"kernel32" (ByVal dwFreq As Long, _
ByVal dwDuration As Long) As Long

Private Sub Worksheet_Change(ByVal Target As Range)
Dim frequency As Long
Dim duration As Long
If Target <> Range("A5") Then Exit Sub
If Target.Value > 50 Then
frequency = 4160
duration = 1500
Call Beep(frequency, duration)
End If
End Sub

HTH
Regards,
Howard
 
L

L. Howard Kittle

I offered a solution that would beep if a value over 50 was entered in a
specific cell. (Although I don't see it as of yet) I reread your post and
you want an alarm if the SELECTED cell value is over 10. Try this.

Option Explicit

Private Declare Function Beep Lib _
"kernel32" (ByVal dwFreq As Long, _
ByVal dwDuration As Long) As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim frequency As Long
Dim duration As Long
If Target.Count <> 1 Then Exit Sub
If Target.Value > 10 Then
frequency = 4160
duration = 1500
Call Beep(frequency, duration)
End If
End Sub

HTH
Regards,
Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top