If the number in the cell is over >10 then it should play a wav sound and if it under <10 then it should speak a word.
The code works for the A column (A1:A6) but the B column (B2) has the same wav and speech as A2.
Thank you for your help.
The code works for the A column (A1:A6) but the B column (B2) has the same wav and speech as A2.
Thank you for your help.
Code:
Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim strSound As String
Dim strtalk As String
If Not Intersect(Target, Range("$A$1,$A$2,$A$3,$A$4,$A$5,$A$6,$B$2")) Is Nothing Then
strSound = Choose(Target.Row, "tada", "ding", "tada", "beep", "ding", "beep", "Drumroll")
strtalk = Choose(Target.Row, "Dog", "Cat", "Pig", "House", "cat", "Rat", "Horse")
If Target.Value > 10 Then
sndPlaySound "C:\WINDOWS\Media\" & strSound, 0
End If
If Target.Value < 10 Then
Application.Speech.Speak strtalk, 0
End If
End If
End Sub