Creating sound alert in excel on change in text of a cell?

Loki1203

New Member
Joined
Feb 2, 2019
Messages
1
I have imported a stock list in excel and have done some calculations. This sheet gets updated from internet every second. Now I have used the vlookup formula in cell A1 to get the stock name against the maximum value. Now i want excel to play a specific sound (not beep) when the text of the Cell A1 changes. Please help me in doing this.

Note - The sheet gets updated every second from internet and the text of Cell A1 may or may not change. There is no manual intervention in changing the cell.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Placing a volatile formula in a cell in (internet-updated) worksheet triggers event macro Worksheet_Calculate when updates occur
Combining that with previous suggestion should play your sound

1 Place this formula in any cell outside the Table
=NOW()
2 Add code below (suggest you test with Beep before using your own macro)
3 Go back to Excel and wait for the sound

Goes in SHEET module (right-click sheet tab \ select View Code \ paste code into code window \ back to Excel {ALT}{F11}

Code:
Private OldA1 As String          '[COLOR=#ff0000][I]ensure this line is placed above all procedures [/I][/COLOR]

Private Sub Worksheet_Calculate()
    If OldA1 <> CStr(Range("A1")) Then Call MakeNoise
    OldA1 = CStr(Range("A1"))
End Sub

Sub MakeNoise()
    'replace Beep with whatever you are using to play your sound
    Beep
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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