Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Sound Alert Request

Posted on 2011-09-05
12
Medium Priority
?
292 Views
Last Modified: 2012-05-12
Hello Experts,

I wonder if someone could provide a formula to sound an alert when cell AQ3 and/or cell AV3 reaches a value of 85.

Please note, this needs to alert when the value changes dynamically not through a manual alert. I also forget to make that distinction when asking for a sound alert.

Cheers


Carlton
EE-Nasdaq-CRSv7.xlsm
0
Comment
Question by:cpatte7372
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
12 Comments
 

Author Comment

by:cpatte7372
ID: 36485871
Oh, and please can you ensure that the alert stops after the value changes from 85.

Cheers
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36486029
Ok - when the calculate happens, I added code to chek the values of both AQ3 and AV3, if 85 or greater, it will chime the alert.  Everytime a calculate happens, this will happen.  When the value is no longer >= 85, the chimes won't happen.

Here's the code:
Private Sub Worksheet_Calculate()
Dim cel As Range
Dim Addr As Variant, Targ As Variant
Static Stocks(3) As Double      'Starts with element 0
Dim i As Long, n As Long


    'Added code
    If ActiveSheet.Range("AQ3").Value > 85 Or ActiveSheet.Range("AV3").Value > 85 Then
        Call soundAlert(True)
    Else
        Call soundAlert(False)
    End If

    Addr = Array("AQ3", "AV3", "AP3", "AU3")    'Watch these cells for price changes
    Targ = Array(85, 85, 20, 20)                'Look for prices above these threshhold values
    n = UBound(Stocks)
    For i = 0 To n
        With Range(Addr(i))
            If Not IsError(.Value) Then
                If Stocks(i) <> .Value Then
                    Stocks(i) = .Value
                    If .Value > Targ(i) Then
                        Open "C:\Users\User\Documents\ABC.txt" For Append As #1  'Change path & name to suit
                        Write #1, .Address(False, False), .Value, Date, Format(Time, "hh:mm:ss.ss")
                        Close 1
                    End If
                End If
            End If
        End With
    Next i

End Sub

Open in new window


For the chime, I used the tip from Chip Pearson's website - its in the soundAlert Module I created.  Here's the site:http://www.cpearson.com/excel/PlaySound.aspx

You can play any WAV file you have on your Desktop for the alert.  I used chime from Chip's example to get this going.

See attached.

Enjoy!

Dave
EE-Nasdaq-CRSv7r1.xlsm
0
 

Author Comment

by:cpatte7372
ID: 36486053
Hi Dave,

Going to play around with it now.....
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:cpatte7372
ID: 36486057
Dave,

I changed a variable and I got the following error message

Compile Error:

Expected variable or procedure, not module.

And then it points to

Call soundAlert(True)
0
 
LVL 42

Accepted Solution

by:
dlmille earned 2000 total points
ID: 36486065
My apologies - at the last minute, I renamed the module to soundAlert - the same name as the subroutine!  fixed.  Sorry about that!

See attached,

Dave
EE-Nasdaq-CRSv7r2.xlsm
0
 

Author Comment

by:cpatte7372
ID: 36486075
No worries mate.

Going to check it out now....
0
 

Author Comment

by:cpatte7372
ID: 36486108
Dave,

I exported the 'soundAlertModule' and then imported it into my live spreadsheet. However, it won't work. Is there something that I'm missing? I can't see any difference between the attached spreadsheet and my live spreadsheet.

Cheers
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36486111
First - did what I post work for you, as-is?

Dave
0
 
LVL 42

Expert Comment

by:dlmille
ID: 36486114
And did you copy over the Worksheet_Calculate() subroutine, overwriting the existing one?

Dave
0
 

Author Comment

by:cpatte7372
ID: 36486130
Uhmmmm, I don't believe I did - not sure what it is. I'll check
0
 

Author Comment

by:cpatte7372
ID: 36486156
Found it. Copied it over and now its working fine.

I'm sure it's fine but will put it to the test when the stock markets open.

In the meantime, as always Dave, thank you very much mate.
0
 

Author Closing Comment

by:cpatte7372
ID: 36519711
Wicked mate....

Cheers
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question