Running a macro when a cell value changes

  • Thread starter Thread starter Emea training
  • Start date Start date
E

Emea training

How can I run a macro called "sounds", when a value within a spreadshee
ie: cell A1 goes over a pre-defined value, located in another cell (sa
a2)?

I have tried but am failing
 
Norm,
:You may want to check your system clock unless xmas is already passed for
you.

--
Don Guillett
SalesAid Software
(e-mail address removed)
Norman Jones said:
Hi Emea,

If the Sounds macro is in a standard module in the workbook,

Right-click the worksheet tab, select View Code and paste the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1"), Target) Is Nothing Then
If Range("A1").Value > Range("A2").Value Then
Sounds
End If
End If
End Sub
 
Hi Don,

Don Guillett said:
:You may want to check your system clock unless xmas is already passed for
you.

Thank you .

A couple of weeks back my clock was off for a couple of hours - the result
of some injudicious system experimentation.

As for Xmas, I find that it has (almost) always passed for me!
 
Hi Emea,

If the Sounds macro is in a standard module in the workbook,

Right-click the worksheet tab, select View Code and paste the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1"), Target) Is Nothing Then
If Range("A1").Value > Range("A2").Value Then
Sounds
End If
End If
End Sub
 

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