Sound For Calculated Number Exceeding Limit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a macro to sound chimes when a number entered in column C exceeds
360. I need it to work when the number is the result of a calculation rather
than manual entry. Is this possible? Could anyone suggest changes to the
following code to accomplish this please? Thanks!

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.Run "chimes"
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
On Error GoTo errors
If Target.Value > 360 Then GoTo errors
End If
Exit Sub
errors:
On Error GoTo 0
Application.Run "chimes"
End Sub
 
Maybe just use the worksheet_calculate event.

And if you mean any cell in column C, you could use something like:

Option Explicit
Private Sub Worksheet_Calculate()
Dim myRng As Range
Set myRng = Me.Range("C:C")

If Application.Max(myRng) > 300 Then
Call Chimes
End If
End Sub

Application.Run isn't necessary in this situation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top