How to enable a sound notification in Excel

If you wanted to hear an audio alert when your data in Excel reaches certain values, then see how you can make an alarm in Excel and activate it.

clock alarm wake up

Excel spreadsheets allow you to have an immediate visual display of its cell values. You can, for example, use the conditional in Excel, to change the color of a cell accordingly with his price.

Although a visual indication is useful, when the cell in question is on another sheet or outside the current one s of the window, then you are not going to notice the change. Wouldn't it be useful if you could have Excel make a sound when certain criteria are met?

It can be done but you will need to dive into the world of Visual Basic to do it. Fortunately, you won't need any programming skills for this. You can simply follow the example below.

How to play a system sound to trigger an alarm in Excel

You can make Excel play a system sound with just a few lines of Visual Basic. You can then trigger that sound based on a cell's value.

To play a system sound in Excel:
play button hand

Step 1: Open Excel and start Microsoft Visual Basic for Applications using the keyboard shortcut Alt + F11.

Step 2: Go to the selection Insert > .
excel make a beep 1

 

Step 3: Enter the following :

Function MakeABeep() as String
    Beep
    MakeABeep = “”
End Function

excel make a beep 2

 

Step 4: Click the Save icon.
excel make a beep 3

 

Step 5: Click on the drop down menu Save as: (Save as Type) and select Excel workbook with macros (Excel Macro-Enabled Workbook) . Your file must be saved in this format for the audio to play.
excel make a beep 4

 

Step 6: Save your workbook.

Step 7: Close the Microsoft Visual Basic for Applications window by clicking the X in the upper-right corner of the window.

Step 8: To test your beep, type the following into any cell: =MakeABeep()
excel make a beep 5
If you press Enter you will hear a system sound.

How to play a custom sound in Excel using Visual Basic

excel, clock, alarm, sound, visual, basic, alarm clock

You can also set Excel to play a specific sound file if you prefer to choose your own sound instead of playing the system default sound.

To play a custom sound in Excel

Step 1: Start Microsoft Visual Basic for Applications by pressing Alt+F11.

Step 2: Click Insert > Module.
excel make a beep 1

 

Step 3: Enter the following code:

#If Win64 Then
    Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
        Alias "PlaySoundA" (ByVal lpszName As String, _
        ByVal hModule As LongPtr, ByVal dwFlags As Long) As Boolean
#Else
    Private Declare Function PlaySound Lib "winmm.dll" _
        Alias "PlaySoundA" (ByVal lpszName As String, _
        ByVal hModule As Long, ByVal dwFlags As Long) As Boolean
#End If
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Function AlarmSound() As String
    Call PlaySound("C:\iguru\dimitris\alarm.wav", _
      0, SND_ASYNC Or SND_FILENAME)
    AlarmSound = ""
End Function

excel make a beep 6

Replace “C:\iguru\dimitris\alarm.wav” with the file location of the audio file you want to use.

Step 4: Close the Microsoft Visual Basic for Applications window.

Step 5: Test your audio by typing the following into any cell: =AlarmSound()

excel make a beep 7

Press Enter and your audio will play.

How to activate an alarm in Excel

excel, clock, alarm, sound, visual, basic, alarm clock

Now that you have set the beep or alarm sound, the last stage is to activate these sounds when needed.

There are many different ways you can choose to activate your alarm. Here's an example of how to use your sound in an IF statement.

To play an alarm when a price reaches a certain level:

Step 1: Select an empty cell.

Step 2: Type: =IF(

Step 3: Click on the cell whose value you want to watch.

Step 4: Type: > followed by the value you want to trigger the alarm.
excel make a beep 8

Step 5: Now type one question mark and after makeaBeep() or AlarmSound().
excel make a beep 9a

Step 6: Type another one question mark and then type: "")

excel make a beep 10

Step 7: Press Enter.

Now, when cell D2, which you're watching, gets a value greater than 100 (which you've set), your alarm will sound. You can test this by typing a value above your limit into the relevant cell.

Unleash the power of Excel

excel, clock, alarm, sound, visual, basic, alarm clock

To learn how to trigger an alarm in Excel, you need to use Visual Basic. Using Visual Basic allows you to make Excel act far beyond its usual scope. However, it requires reasonable knowledge of the programming language and how it works with Excel.

Excel can also do many things without the need to use Visual Basic. You can write macros in Excel that will replay a series of actions. Once created, you can save your macros for use in other spreadsheets.

You can also create Excel formulas using the many built-in functions in Excel, such as VLOOKUP, TRUNC, or any of the many other useful functions.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.100 registrants.
excel, clock, alarm, sound, visual, basic, alarm clock

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).