Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default add a sound if cell A180, A290, B1100, etc.....

Hi Everyone,

Very Newbie here.. ;)

I was searching board and found bottom code and it works on ONE cell.

Q1) But I want to have Sound Alarm for Mutiple cells:

When
A1=80
A2=90
B2=80
R5=100
....etc..

Q2) And when from Cell B1 to B17 and if any cell value is = 100

Q3) How can I make sound to run about 10 seconds?

Thank you in advance....

Option Explicit
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Sub Worksheet_Calculate()
If Me.Range("A1").Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 419
Default add a sound if cell A180, A290, B1100, etc.....

Astroboy,

Q3) How can I make sound to run about 10 seconds?


You can't make this sound play longer than 10 seconds. You have a couple
options. You could put multiple play sound commands in the code:

If TRUE Then
If True Then
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
End If
End If

(I haven't tested this. I don't know if the sounds will overlap each other)

Or you can pick 1 sound that is 10 seconds in length. Or you can use
Windows Sound Recorder (%SystemRoot%\System32\sndrec32.exe) to edit this
sound (make a new file) so that it plays multiple times. I don't remember
if Sound Recorder has the tools/ability to copy the whole sound and paste
multiple instances at the end of the current sound recording. You'll have
to experiment with it. If Sound Recorder won't do it, I'm sure you can find
several free programs online that will allow you to do that.

HTH,

Conan




"Astroboy" wrote in message
...
Hi Everyone,

Very Newbie here.. ;)

I was searching board and found bottom code and it works on ONE cell.

Q1) But I want to have Sound Alarm for Mutiple cells:

When
A1=80
A2=90
B2=80
R5=100
...etc..

Q2) And when from Cell B1 to B17 and if any cell value is = 100

Q3) How can I make sound to run about 10 seconds?

Thank you in advance....

Option Explicit
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Sub Worksheet_Calculate()
If Me.Range("A1").Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End If
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 419
Default add a sound if cell A180, A290, B1100, etc.....

Astroboy,

Q1) But I want to have Sound Alarm for Mutiple cells:

When
A1=80
A2=90
B2=80
R5=100
...etc..

Q2) And when from Cell B1 to B17 and if any cell value is = 100


I'm thinking the easiest way to do this might be to use a helper cell that
is hidden or out of the way. I'm gonna use cell C1 in this example, you can
choose which ever cell makes sense to you.

Use this formula in Cell C1:

=OR(A1=80,A2=90,B2=80,R5=100,...etc...,COUNTIF (B1:B17,"=100"))

Then in your code, you could do something like this:

If Range("C1") Then
sndPlaySound32 "chimes.wav", 0
End If


HTH,

Conan




"Astroboy" wrote in message
...
Hi Everyone,

Very Newbie here.. ;)

I was searching board and found bottom code and it works on ONE cell.

Q1) But I want to have Sound Alarm for Mutiple cells:

When
A1=80
A2=90
B2=80
R5=100
...etc..

Q2) And when from Cell B1 to B17 and if any cell value is = 100

Q3) How can I make sound to run about 10 seconds?

Thank you in advance....

Option Explicit
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Sub Worksheet_Calculate()
If Me.Range("A1").Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End If
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default add a sound if cell A180, A290, B1100, etc.....

Oh.... I can do that.... and THANK YOU~~!!

"Conan Kelly" wrote:

Astroboy,

Q3) How can I make sound to run about 10 seconds?


You can't make this sound play longer than 10 seconds. You have a couple
options. You could put multiple play sound commands in the code:

If TRUE Then
If True Then
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
sndPlaySound32 "chimes.wav", 0
End If
End If

(I haven't tested this. I don't know if the sounds will overlap each other)

Or you can pick 1 sound that is 10 seconds in length. Or you can use
Windows Sound Recorder (%SystemRoot%\System32\sndrec32.exe) to edit this
sound (make a new file) so that it plays multiple times. I don't remember
if Sound Recorder has the tools/ability to copy the whole sound and paste
multiple instances at the end of the current sound recording. You'll have
to experiment with it. If Sound Recorder won't do it, I'm sure you can find
several free programs online that will allow you to do that.

HTH,

Conan




"Astroboy" wrote in message
...
Hi Everyone,

Very Newbie here.. ;)

I was searching board and found bottom code and it works on ONE cell.

Q1) But I want to have Sound Alarm for Mutiple cells:

When
A1=80
A2=90
B2=80
R5=100
...etc..

Q2) And when from Cell B1 to B17 and if any cell value is = 100

Q3) How can I make sound to run about 10 seconds?

Thank you in advance....

Option Explicit
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Sub Worksheet_Calculate()
If Me.Range("A1").Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value 10 Then
sndPlaySound32 "chimes.wav", 0
End If
End If
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default add a sound if cell A180, A290, B1100, etc.....

Hi Conan,

Thank you for helping me out.... :)





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
Play Sound File Once when cell value condition id met John 1 Excel Discussion (Misc queries) 4 September 1st 07 04:32 PM
sound or speech the value of the cell if value 10 CC Excel Worksheet Functions 2 July 11th 06 04:22 PM
add a sound if Cell R6 value greater than 120 Moses Excel Discussion (Misc queries) 4 June 28th 06 12:59 PM
Can a sound be inserted in a cell? nagao Excel Worksheet Functions 1 January 26th 06 09:17 PM
How do you add sound file to a cell in excel Martin Excel Worksheet Functions 9 May 2nd 05 01:12 AM


All times are GMT +1. The time now is 07: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"