ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If a cell contains a certfain value, Beep (https://www.excelbanter.com/excel-programming/374164-if-cell-contains-certfain-value-beep.html)

Mike H.[_2_]

If a cell contains a certfain value, Beep
 
I want to be alerted if a certain value would ever be the value of a cell.
For example, if I have a balance sheet and the total Assets do not equal the
total liabilities, I want to be notified. But I don't want to have to run a
vb macro to be alerted. I thought I could just get a notification when the
recalc is done that something is wrong. How do I set this up? I don't want
to add a Watch to a cell, because you get no visual or audio that there is a
problem. It just shows up in the watch box. I want to be beeped the instant
an out-of-balance condition is created. Thanks for any help you can give me.

JLGWhiz

If a cell contains a certfain value, Beep
 
See this site:
http://office.microsoft.com/en-us/ma...298391033.aspx

"Mike H." wrote:

I want to be alerted if a certain value would ever be the value of a cell.
For example, if I have a balance sheet and the total Assets do not equal the
total liabilities, I want to be notified. But I don't want to have to run a
vb macro to be alerted. I thought I could just get a notification when the
recalc is done that something is wrong. How do I set this up? I don't want
to add a Watch to a cell, because you get no visual or audio that there is a
problem. It just shows up in the watch box. I want to be beeped the instant
an out-of-balance condition is created. Thanks for any help you can give me.


Charles Chickering

If a cell contains a certfain value, Beep
 
Mike, in a normal module paste this code:
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

Sub PlayWAV()
'Adapted from Jwalks code @: http://j-walk.com/ss/excel/tips/tip59.htm
Dim WAVFile As String
WAVFile = "C:\WINDOWS\Media\Windows XP Error.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Then in the code for the sheet you are working on paste this code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Code written 10_2_2006 By Charles Chickering
If Not Intersect(Target, Range("A1").Precedents) Is Nothing Then
If Range("A1") 90 Then
Call PlayWAV
MsgBox "A1 is greater than 90"
End If
End If
End Sub
--
Charles Chickering

"A good example is twice the value of good advice."


"Mike H." wrote:

I want to be alerted if a certain value would ever be the value of a cell.
For example, if I have a balance sheet and the total Assets do not equal the
total liabilities, I want to be notified. But I don't want to have to run a
vb macro to be alerted. I thought I could just get a notification when the
recalc is done that something is wrong. How do I set this up? I don't want
to add a Watch to a cell, because you get no visual or audio that there is a
problem. It just shows up in the watch box. I want to be beeped the instant
an out-of-balance condition is created. Thanks for any help you can give me.



All times are GMT +1. The time now is 02:27 PM.

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