How do I record new Highest / Lowest numbers as data changes in ce

H

Highbury 1

Hi, I'm quit new to using excel (07) but have so far been very impressed by
both it's features and it's ease of use - However I have stumbled upon a
problem that I cannot get around - PLEASE help me if you can...

I have a formula that returns a numeric value to a specific cell, Say A1,
this number will always be in the range of 0 to 1,000. A number of different
variables influence what the returned value is and this value changes
approximately 5 times per second. I want to be able to show the highest and
lowest value achieved in cells B1 (highest) and B2 (lowest) and have these
two cells both start out at 0 but auto update as a new high or low is
returned in A1

Any ideas on how I can achieve this or where I can go to find an answer
would be great.

Many Thanks,

Mike.
 
G

Gary''s Student

In B1 enter -1
In B2 enter 1001

In the worksheet code area enter:

Private Sub Worksheet_Calculate()
Set a1 = Range("A1")
v = a1.Value
Set b1 = Range("B1")
Set b2 = Range("B2")
Application.EnableEvents = False
If v > b1.Value Then
b1.Value = v
End If

If v < b2.Value Then
b2.Value = v
End If
Application.EnableEvents = True
End Sub
 
H

Highbury 1

Thanks so much for that, works like a charm....

Gary''s Student said:
In B1 enter -1
In B2 enter 1001

In the worksheet code area enter:

Private Sub Worksheet_Calculate()
Set a1 = Range("A1")
v = a1.Value
Set b1 = Range("B1")
Set b2 = Range("B2")
Application.EnableEvents = False
If v > b1.Value Then
b1.Value = v
End If

If v < b2.Value Then
b2.Value = v
End If
Application.EnableEvents = True
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

Top