Conditional statments.

P

Paul987

I have a cell that changes values, call it cell A1. What I want t
happen, is once A1 becomes >5000, I want B1 to do something. Doesn'
matter. Turn blue show "99999", I don't care. What matters is that i
needs to maintain that condition even if A1 once again becomes <5000.
This is why I can't get a formula or conditional formating to work
because once if A1 becomes > 5000 for a bit, and then changes to <5000
the formatting disappears. Any Ideas?
Thanks

Pau
 
S

swatsp0p

What you ask would require VBA (in a worksheet_change event). Do yo
want to go that route
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value > 5000 Then
.Offset(0, 1).ColorIndex = 5
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Top