A visual indication is useful, but if the cell in question is on another sheet or off the edge of your current view, then you’re not going to notice the change. Wouldn’t it be useful if you could get Excel to make a sound when certain criteria are met? The good news is that it is possible to do, although you’ll need to dip your toe into the world of Visual Basic to do so. Thankfully, you won’t need any programming skills to get this to work; you can simply copy and paste the code below. Here’s how to ring an alarm in Excel.

How to Play a System Sound to Ring an Alarm in Excel

You can make Excel play a system sound with just a few lines of Visual Basic. You can then trigger this sound based on the value of a cell. To play a system sound in Excel:

Launch Microsoft Visual Basic for Applications by using the keyboard shortcut Alt+F11.Go to Insert > Module. Enter the following code:Function MakeABeep() as String Beep    MakeABeep = “” End FunctionClick the Save icon. Click on the Save as Type drop-down and select Excel Macro-Enabled Workbook. Your file needs to be saved in this format for the sound to play. Save your workbook.Close the Microsoft Visual Basic for Applications window by clicking the X in the top-right hand corner of the window. To test your beep, type the following into any cell: =MakeABeep()

Press Enter, and you should hear a system sound.

How to Play a Custom Sound in Excel Using Visual Basic

You can also get Excel to play a specific sound file if you prefer to choose your own sound rather than playing the default system beep. To play a custom sound in Excel:

Launch Microsoft Visual Basic for Applications by pressing Alt+F11.Click Insert > Module. 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:\Users\adam\Downloads\alarm.wav”, _      0, SND_ASYNC Or SND_FILENAME)    AlarmSound = "" End FunctionReplace “C:\Users\adam\Downloads\alarm.wav” with the file location of the sound file you want to use. The easiest way to get the full file path is to navigate to the file in Windows Explorer, right-click on it, and select Copy as Path. Close the Microsoft Visual Basic for Applications window. Test your sound by typing the following into any cell: =AlarmSound()

Press Enter, and your sound should play.

How to Trigger a Sound to Ring an Alarm in Excel

Now that you have set up your beep or alarm sound, the final stage is to trigger these sounds when needed. There are many different ways you can choose to trigger your alarm. Here is an example of how to use your sound in an IF statement. To play an alarm when a value reaches a certain level:

Select an empty cell.Type: =IF(

Click the cell you want to monitor the value of.Type: > followed by the value you want to trigger the alarm. Now type a comma, then MakeaBeep() or AlarmSound(). Type another comma, then type: “”)

Press Enter. Now when the cell you are monitoring exceeds the value you set, your alarm will sound. You can test this by typing a value above your threshold into the relevant cell.

Unleash the Power of Excel

Learning to ring an alarm in Excel requires you to use Visual Basic. Using Visual Basic allows you to get Excel to do things far beyond its usual scope. However, it requires a reasonable knowledge of the programming language and how it works with Excel. Excel can do plenty of things without the need for using Visual Basic. You can record macros in Excel that will replay a series of actions. Once created, you can save your macros to 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. Comment

Δ