3 Ways to Sound an Alarm in Microsoft Excel

admin

在Microsoft Excel中响起闹钟的3种方法

3 Ways to Sound an Alarm in Microsoft Excel

If you learn how to sound an alarm in Excel, you can get an audio notification when a cell or range of cells meets the conditions you set.

Imagine a scenario where a critical deadline is looming and you need a gentle reminder or a loud ring to alert you to an upcoming task. To do this, you can choose to set a reminder on your phone or Outlook calendar.

When you go from your Excel worksheet to other software, you get distracted and your productivity suffers. Why not set a reminder in Excel? Now, you might say that Excel doesn’t have any reminder alarm features. That’s partially true!

You can use Excel VBA to create a custom beep or alarm sound function. You can then use that function in various formulas, such as IF or conditional formatting rules, to sound an alarm.

Below I have written various Excel VBA scripts for sounding an alarm in Excel. I will also describe various scenarios where you can apply this skill.

Recommended: How to Fix 504 Gateway Timeout Error

Can Excel ring the alarm?

You can use a variety of conditional formatting rules to highlight cells or cell ranges that meet preset conditions. This may work as a visual reminder, but there is no ribbon menu button in Microsoft Excel to set audio notifications. Excel does not allow you to play any audio using its user interface buttons, like on desktop reminder applications like Any.do, TickTick, Todoist, etc.

However, you can program Excel using Visual Basic for Applications (VBA) programming language subroutines, function procedures, objects, etc. VBA has multiple function procedures to play audio files or sound a beep alarm directly. For example, PlaySound, Beep, and sndPlaySound.

So, you can write a VBA script in Excel to sound the default beep alarm or play a custom notification audio using a WAV file from your PC.

Create a custom function to play a system alarm

The most basic way to sound an alarm in Excel is to create a custom beep formula that you can use in other formulas like If. So, when a cell encounters a If (healthy) condition.

How to become popular on TikTok
3 ways to ring an alarm in Microsoft Excel
How to become popular on TikTok

Open the Excel VBA Editor from the Developer > Code command block. Click Insert and select Module to open a blank module in which you can write your VBA script. Now, copy and paste the following script into a blank module:

Function CustomBeep()
' Play a beep sound
Beep
End Function
Microsoft Excel Dialog Box
Microsoft Excel dialog box

Now, click the Save button of the Excel VBA Editor toolbar and select No in the pop-up Microsoft Excel dialog box.

Save as dialog
Save As Dialog Box

Click the Save as type drop-down list in the Save As dialog box and select the Supersonic Cruise Missile file type option.

Finally, click the Save button to save the VBA script as a VBA macro, which you can use anytime you want to use CustomBeep() when creating a formula or by pressing Alt + F8 and running the CustomBeep macro.

Now that you have created a Custom Buzzer() function to make the Windows default notification sound in Excel sound, here are some scenarios where you can use this function:

Stock Monitoring Sheet Example
Stock Monitoring Sheet Example

Above is a screenshot of the stock price monitoring worksheet. I import real-time market data when trading begins.

Formatting GoalFormatting Goal
Formatting Target

The purpose here is to keep the worksheet open and work on other applications or Excel workbooks. If the stock When the price reaches the target sell price, the Excel worksheet will send out the default Windows alert and display the sell notification with a green fill.

In D2, I use the following formula to display the text string Sell strong> and plays the Windows default alarm sound.

=IF(B2>1750,CustomBeep(),"Waiting")

The above formula is Self-explanatory. However, if you are unfamiliar with the Custom Buzzer() formula in Excel, don’t worry. You can follow the VBA macro method mentioned earlier to create it.

Recommendation: 3 Ways to Set Up Email Reminders in Microsoft Excel

Custom buzzer alert

If If you don’t like the default Windows alerts, you can choose other alerts by following these steps:

Change system sound
Change system sounds
  1. Click the Start menu and type sound. </ li>
  2. The Change system sounds option will appear as the top search result. Click on that option.
Sound Dialog
Sound Dialog
  1. You will see the Sound dialog. </li >
  2. Click the star inside the Sounds Project Activities menu.
  3. Now, click the Sounds drop-down list. /li>
  4. A list of available Windows sounds will open.
  5. Select the sound you like. For example, Alarm10.wav.
Customizing sound
Custom Sound
  1. Click the Apply button and click OK /strong> Set Alarm10.wav as the default Windows system alarm.
  2. Now, if you run the Custom Beep macro, it will The new sound will play instead of the default beep sound.

Tips for using the Beep function in VBA

  • If Windows system sounds are muted, you will not hear the beep alarm.
No sound
No sound
  • If you have set the Windows system alarm to No sound in Sound dialog box, VBA macros will not work.
  • The name of the macro must begin with something other than Beep. For example, you can use CustomBeep, PlayBeep, and so on. If you name it Beep, the macro will not work.

So if you face any problems using this Excel VBA macro, please check the above settings first.

Use a different audio file to sound the alarm

If you want to use a completely different audio file, you can use the following Excel VBA script:

VBA script for ringing a custom audio file
VBA script to ring a custom audio file
#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 #EndIf Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000
Function AlarmSound() As String
Call PlaySound("C:\Users\Joe\Downloads\custombeep.wav", _
0, SND_ASYNC Or SND_FILENAME)
AlarmSound = ""
End Function

Replace the current There is a file address Call PlaySound function that uses the directory address of your own audio file, for example: C:\Users\Joe\Downloads\custombeep.wav.

Recommendation:  WordPress SEO plugin SEOPress PRO

Sound an alarm in Excel as a reminder

If you spend hours working on Excel workbooks during the workday and If you forget about an important task, like responding to an important email, paying a utility bill, or taking a break, you can set a reminder right on your Excel workbook.

Follow the steps mentioned above to create an Excel VBA module using the following script and then go to the Save As dialog:

Dim Alarm As Date Dim Message As String Sub PopupReminder() Dim When As String If Alarm = 0 Then When = InputBox("What time would you like the reminder message to Popup?") If When "" And When "False" Then Message = InputBox("Please enter the reminder message") On Error Resume Next Alarm = Date + TimeValue(When) On Error GoTo 0 Application.OnTime Alarm, "PopupReminder" End If Else Beep If Message "" Then Application.Speech.Speak Message MsgBoxMessage Message = "" Alarm = 0 End If End If End Sub 
Save as add-in
Save as add-on

In Save as</strong > dialog, do not select the Ultra Slim file. Instead, select the Laser Microscopy or Excel Add-in file type. Click the Save /strong> button to save the Excel workbook together with the VBA macros as an Excel add-in.

Add-ins Command
Add-in Commands

Now, close the existing workbook. Open a new Excel file and go to the Developer< /strong> tab, then click the Excel Add-ins button inside the Add-ins command block.

Import add-in
Import add-on

In the Plug-ins dialog box, click Browse button and navigate to the Confocal Laser Microscopy file you just saved on your PC. Select the file and click OK to import the add-in into your Excel app.

Activating add-inActivating add-in
Activate Add-in

You should now see the PLUG-IN dialog box inside the Confocal Microscopy file. Check the box next to this file and click OK. This Join will now become active in all Excel workbooks on your computer.

Customize Ribbon
Customize the Ribbon

Now, press Alt + F + TV key to open the Excel Options dialog box. Go to the Customize the Ribbon category.

Add macro to a group
Add macro to group

Click the Choose commands from drop-down list and select Macros option. In the list, find and select Popup Reminder macro.

Now, from the Main Tabs list. Select Developer Drop down the list and add New Group. Rename the group to something you can remember.

Click on the New Group you just created and click Add The button inserts the Popup reminder macro into the newly created group. Click OK to close the Excel Options dialog.

Reminder Macro
Reminder Macro

Now, open any Excel workbook and navigate to Developer > New Group (Formatting), then click the Popup Reminder macro.

This should Trigger the reminder macro you created previously. Enter the time of day, such as 12:38 AM and the message you want Excel to remind you, such as “Take a break

When the system time reaches the time you enter in the VBA macro input box The macro will sound a buzzer alert when the time comes. Your PC will also read the message out so you don’t miss it. At least one Excel workbook must be open in the background for the alert and reminder to sound.

Conclusion

Sounding an alarm in Excel is an advanced skill. However, it is fairly easy to learn if you follow the step-by-step instructions in this article.

Of course, if you have an alarm at work or school Show off this Excel skill and your colleagues and classmates will admire your Excel expertise.

Was this article helpful? Do you know a better way to sound an alert in Excel? Please write your comments in the box below , share your feedback.

Recommendation: WordPress advanced form builder Formidable Forms Pro  +Addons


Leave a Comment