View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default Macro Continuous Execution

Hi John


Read Chip's page about events:

http://www.cpearson.com/excel/Events.aspx

But don't use a macro for this in real life, use conditional formating.

HTH. Best wishes Harald

"Johnb34" wrote in message
...
Just getting started with Visual Basic.
I have a sinple worksheet. Cell B1 contains the formula: "SUM(A1:A5).

The Macro is:
Sub ConditionalBkgChg()

If Range("B1") < 5 Then
Range("B1").Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select
Else
Range("B1").Select
Selection.Interior.ColorIndex = 46
Range("A1").Select
End If
End Sub

If B1 is 5 or greater then the background color turns red.

The Macro works but... I have to run the macro manually after changing
the
values. How can I make the macro run continuously?

Thanks

Johnb3