How do you add sound file to a cell in excel

M

Martin

I want to add a sound file to any cell in excel so that when the data is
entered into the cell by a user or when a calculation is performed by say an
IF statement, that expression is TRUE then a sound is made.
 
D

Don Guillett

You might use a worksheet_change event to hyperlink to a .wav file anywhere
on your computer.
 
D

Don Guillett

right click sheet tab>view code>insert this>modify to suit>SAVE
Now if you ENTER something in that cell the .wav will play

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
ActiveWorkbook.FollowHyperlink Address:="c:\yourfolder\yourwavefile.wav"
End If
End Sub
 
M

Martin

Hi Don, this work fine if I enter the data in this cell, so thanks for this,
but I want to add data into say cell $D$3 and using an if statement, if it is
true and the text appears in the cell the ding sounds.
like:
if(D3>10,"too high","")

so if the value in cell 3 is more than 10 then the sound is played otherwise
it is silent
 
M

Martin

Hi Don

The value in $D$3 controls how the if statement in $A$1 responds, what I
need is that when "too high" appears in cell $A$1 because the value is higher
than the IF statement criteria the sound is activated
 
D

Don Guillett

How about a worksheet_calculate instead

Private Sub Worksheet_Calculate()
If Range("a1") = "too high" Then MsgBox "Hi"
End Sub
 
G

George

Hi Martin
I want to do the same thing but have not been successfull, have you found a
solution?
 
Top