"Sound Me" alert plays when time updates and/or whenever anything is changed on Sheet

Marksma

New Member
Joined
Jan 16, 2015
Messages
18
Excel 2010 and Windows 7

I have muddled through and found a VBA code that plays "tada" sound whenever the word ALERT shows up in a cell in Column E. The ALERT is formulated to show up in Column E when

1. The time in column B is within one hour of the current time (using VBA to update cell Z1 =Now() every minute)
2. The date matches the current date in Column AA (using the =today()
3. The words No Activation are in Column K

=IF(AND(B5-$Z$1<1/24,K5="No Activation",A5=$AA$1),"ALERT","") is the formula in column E

Then in column F I have this formula
=IF(E5="ALERT",SoundMe(),"")

The Sound Me VBA code that I copied and pasted into the VBA editor Module 2 is (Module 1 has the auto update the time 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

Function SoundMe() As String
Call PlaySound("c:\windows\media\tada.wav", _
0, SND_ASYNC Or SND_FILENAME)
SoundMe = ""
End Function

I would like the tada to sound only once for each time Column E changes to ALERT. Right now it seems to play tada everytime I edit any cell in other parts of the work sheet. It also seems to play every minute when the time updates???

If you can't tell. I don't really know what I'm doing. I'm a "google and try it" kind of excel user...learning as I go but not really understanding what I'm doing.
 
Geez, sorry for all the posts...I don't see a way to edit my last one(s)....I think I got it to work!! I took out the Sheet 1 and Module 1 parts that reformatted Z1 and pasted yours and it seems to be working! Yay! I'm super excited! Thank you, Thank you, Thank you!
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top