View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default automatic updating cell

Try this:

Function NewHigh(checkCell As Range)
Static oldhigh
NewHigh = oldhigh
If checkCell.Value oldhigh Then
oldhigh = checkCell.Value
NewHigh = checkCell.Value
End If
End Function

Regards

Trevor


"j feka" wrote in message
...
I'd like to create a function that will automatically
store a new high value of another cell when it occurs,
but will not change if that first cell's value drops.

I've tried something like

Function NuHi(OldHi, PriceNow)
NuHi = OldHi
If PriceNow OldHi Then
NuHi = PriceNow
OldHi = PriceNow
End If
End Function

But this won't work. If I remove the
OldHi = PriceNow line, the function will take a value
from another cell which is put in the OldHi parameter,
but if that value goes down, the function gives a lower
value.

Can anyone help?