Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default automatic updating cell

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default automatic updating cell

Thanks Tevor,

I don't think this will do the trick because the oldhigh
will be there when I want to use the function in a
different cell.

Simple example of what I want to do.

In cell B1 store a high value, then if A1B1 replace the
value in B1 with A1.

Now, using the same function I will want to test

A2 against the value in B2
and
A3 against the value in B3

Each row may have totally different high values.

Jack


-----Original Message-----
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?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default automatic updating cell

Thanks for the try Trevor, but unless I'm mistaken your approach won't
work if I have more than one oldhigh.

Suppose I have Newvalue in cell A1 and the stored HighValue in cell B1.
If I use the function NewHigh(A1) in B1 the value which is in there will
be tested against oldhigh.

Now suppose I have another Newvalue (different value) in A2 and I want
to test it against a value which is unique to that row which I store in
B2. If I put the function NewHigh(A2) into B2, won't I be testing it
against the value which was established in Row 1?

I intend this function to work in multiple rows, not just one or two.

Am other ideas?
Jack


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic updating Barb H Excel Worksheet Functions 0 February 12th 10 05:10 PM
automatic updating rayteach Charts and Charting in Excel 1 June 11th 09 11:10 AM
cell values/automatic updating megspullingherhairout Excel Discussion (Misc queries) 0 September 10th 08 01:22 PM
automatic updating sanders Excel Discussion (Misc queries) 0 July 27th 06 02:45 PM
Automatic Updating Charts Rich Gibbons Charts and Charting in Excel 2 October 9th 05 11:36 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"