ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   adding sound to an excel i.e. warning if data is negative (https://www.excelbanter.com/excel-discussion-misc-queries/76662-adding-sound-excel-i-e-warning-if-data-negative.html)

CDG

adding sound to an excel i.e. warning if data is negative
 
how to do it?

kassie

adding sound to an excel i.e. warning if data is negative
 
In your dreams mate

"CDG" wrote:

how to do it?


CDG

adding sound to an excel i.e. warning if data is negative
 
thank you very much

"kassie" wrote:

In your dreams mate

"CDG" wrote:

how to do it?


Dave Peterson

adding sound to an excel i.e. warning if data is negative
 
Maybe John Walkenbach's instructions will help:
http://www.j-walk.com/ss/excel/tips/tip87.htm

CDG wrote:

how to do it?


--

Dave Peterson

Gary''s Student

adding sound to an excel i.e. warning if data is negative
 
Enter this macro in worksheet code:


Sub Worksheet_Change(ByVal Target As Excel.Range)
' gsnu
If Intersect(Range("A1:A10"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Value < 0 Then
s = "warning negative value"
Application.Speech.Speak s
End If
Application.EnableEvents = True
End Sub


The routine checks entries in A1 thru A10. If the entries are negative, a
warning is issued.


Just be sure to put the code in worksheet code, not a module.
--
Gary's Student


"CDG" wrote:

thank you very much

"kassie" wrote:

In your dreams mate

"CDG" wrote:

how to do it?


CDG

adding sound to an excel i.e. warning if data is negative
 
thanks m8


"Dave Peterson" wrote:

Maybe John Walkenbach's instructions will help:
http://www.j-walk.com/ss/excel/tips/tip87.htm

CDG wrote:

how to do it?


--

Dave Peterson


David

adding sound to an excel i.e. warning if data is negative
 
?B?R2FyeScncyBTdHVkZW50?= wrote

Enter this macro in worksheet code:


Sub Worksheet_Change(ByVal Target As Excel.Range)
' gsnu
If Intersect(Range("A1:A10"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Value < 0 Then
s = "warning negative value"
Application.Speech.Speak s
End If
Application.EnableEvents = True
End Sub


The routine checks entries in A1 thru A10. If the entries are
negative, a warning is issued.


Just be sure to put the code in worksheet code, not a module.


I couldn't get it to work in XL2000 (error 438), but some searching allowed
me to adapt:

Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim s As Object
Set s = CreateObject("SAPI.SpVoice")
If Intersect(Range("A1:A10"), Target) Is Nothing Then GoTo ws_exit
Application.EnableEvents = False
If Target.Value < 0 Then
s.Speak "warning,, negative value" 'dbl commas introduce a pause
End If
ws_exit:
Set s = Nothing
Application.EnableEvents = True
End Sub

--
David


All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com