Hallo,
I want to get a signal (play a wav file) if a specified cell is > or <
specified value.
How do i do that?
Bye Peter
Hi Peter,
Give this a try, where you have values in C12:C20 and compare them to the values in E12:E20.
(I believe I had some help from Claus or GS on this code some months ago)
Regards,
Howard
Option Explicit
Option Compare Text
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub CheckMyValues()
Dim c As Range
Range("C12").Select
For Each c In Range("C12:C20")
If c.Value = c.Offset(0, 2).Value Then
MsgBox "Answer " & c & " is equal.", vbOKOnly
c.Offset(1, 0).Select
Else
If c.Value > c.Offset(0, 2).Value Then
sndPlaySound32 "C:\Windows\Media\Chimes.wav", 0&
MsgBox "Answer " & c & " is greater than.", vbOKOnly
Else
sndPlaySound32 "C:\Windows\Media\woohoo.wav", 0&
MsgBox "Answer " & c & " is less than "
End If
End If
c.Offset(1, 0).Select
Next
End Sub