We help IT Professionals succeed at work.

Hi, how to make a cell formula to only beep once in excel?

In excel, I have used vba's beep function to use that in cells. Now, the cell value changes incrementally (the cell value may incrementally increase or decrease).  The incremental value is +/- 100 only.  For eg., if the cell value is 1200 from the data feed, it positively increments either to 1300, 1400, 1500, etc., or negatively increments to 1100, 1000, etc.  I am only concerned about "A" particular cell in an excel sheet because the data feed happens only in ONE particular cell.

For every increment, I have used the VBA beep function to alert me.

Whenever the beep happens, I have to manually change the formula (=if(D5<>1500,beepnow,"") to the increment that just had happened. Else, it keeps on beeping.

What I require is, the formula should automatically beep once - that's all!  Then, the beep should happen only when there is incremental "change" in the cell D5. Otherwise, the beep shouldn't happen.  The data feed happens during most part of the day, but I wouldn't know when it would happen; hence this beep alert is a kind of helping me instead of sitting always in front of the system waiting.....

Can it be done with a formula or can it be done via VBA?  Kindly, help me on this.  Thank you! Prabhu
Watch Question

Test your restores, not your backups...
Expert of the Year 2019
Top Expert 2016
Add this routine to the VBA for the specific Sheet you are monitoring,  Notice it specifies the cell to watch for a change, in your case D5.  Adjust the call to Beepnow if that isn't right, but that will execute anytime that cell (D5) changes.  No need for the other formula in a cell that you have.

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim TriggerCell As Range
    Set TriggerCell = Range("D5")
    If Not Application.Intersect(TriggerCell, Range(Target.Address)) Is Nothing Then
        Call Beepnow
    End If
End Sub

Open in new window

Fabrice LambertConsulting
Distinguished Expert 2017


I would use a static variable in your beepNow function:
Function Beepnow()
    Static triggered As Boolean

    If Not triggered Then
        triggered = True    '// never gonna beep again, as long as the workbook isn't closed.
    End If
End Function

Open in new window


Hi Bill, It is great SOLUTION! Cheers! Thank you so much.!!!