Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
SellUnHi
 
Posts: n/a
Default Can I set an audio alert that triggers as Excel cell value chgs?

I would like to add an audio alert to a spreadsheet cell whenever it changes
to a specific value? Can this be done?
  #2   Report Post  
JR
 
Posts: n/a
Default

....I'm not familiar with any audio alerts but, you can use conditional
formatting to the cell's format change when it value changes. Go to
Format...Conditional Formatting. You can then either set a value or use a
formula and set the format (what it will look like when the cell is the value
that you set).

"SellUnHi" wrote:

I would like to add an audio alert to a spreadsheet cell whenever it changes
to a specific value? Can this be done?

  #3   Report Post  
Jason Morin
 
Posts: n/a
Default

Let's assume A1. Right-click the worksheet tab, select View Code, and place
in the following:

Sub Worksheet_Change(ByVal Target As Range)

Dim strSoundPath As String
Dim strSoundFile As String

'Change path and file name
strSoundPath = "C:\I386\"
strSoundFile = "Chimes.WAV"

'Change cell address if not A1
If Not Intersect(Target, Me.[A1]) Is Nothing Then
Call sndPlaySound32(strSoundPath & strSoundFile, 0)
End If

End Sub

---

Now place the following in a regular module:

'Play sound - www.cpearson.com
Public Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

---

HTH
Jason
Atlanta, GA


"SellUnHi" wrote:

I would like to add an audio alert to a spreadsheet cell whenever it changes
to a specific value? Can this be done?

  #4   Report Post  
Jason Morin
 
Posts: n/a
Default

Sorry, I didn't read your post carefully. The code I posted plays the sound
whenever A1 is manually changed. If you want the sound to play when the cell
value is changed manually to, say, 10, then change the first part to:

Sub Worksheet_Change(ByVal Target As Range)

Dim strSoundPath As String
Dim strSoundFile As String

'Change path and file name
strSoundPath = "C:\I386\"
strSoundFile = "Chimes.WAV"

'Change cell address and value to suit
If Not Intersect(Target, Me.[A1]) Is Nothing Then
If Target.Value = 10 Then
Call sndPlaySound32(strSoundPath & strSoundFile, 0)
End If
End If

End Sub

---

If there is a formula in A1, then use:

Private Sub Worksheet_Calculate()

Dim strSoundPath As String
Dim strSoundFile As String

'Change path and file name
strSoundPath = "C:\I386\"
strSoundFile = "Chimes.WAV"

'Change cell address and value to suit
If Me.[A1].Value = 10 Then
Call sndPlaySound32(strSoundPath & strSoundFile, 0)
End If

End Sub

---

HTH
Jason
Atlanta, GA


"Jason Morin" wrote:

Let's assume A1. Right-click the worksheet tab, select View Code, and place
in the following:

Sub Worksheet_Change(ByVal Target As Range)

Dim strSoundPath As String
Dim strSoundFile As String

'Change path and file name
strSoundPath = "C:\I386\"
strSoundFile = "Chimes.WAV"

'Change cell address if not A1
If Not Intersect(Target, Me.[A1]) Is Nothing Then
Call sndPlaySound32(strSoundPath & strSoundFile, 0)
End If

End Sub

---

Now place the following in a regular module:

'Play sound - www.cpearson.com
Public Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

---

HTH
Jason
Atlanta, GA


"SellUnHi" wrote:

I would like to add an audio alert to a spreadsheet cell whenever it changes
to a specific value? Can this be done?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA for Excel 2000 file is corrupt nkamp Excel Discussion (Misc queries) 0 May 26th 05 03:37 PM
Open excel from htm page den Excel Discussion (Misc queries) 0 April 25th 05 11:58 PM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Excel error - Startup (and Acrobat PDFMaker) gxdata Setting up and Configuration of Excel 0 February 4th 05 03:44 AM


All times are GMT +1. The time now is 08:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"