Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Maximums

A macro runs until a certain cell = *x*.
For each loop a new numeric value is calculated in A1.
I need to know the maximum value that A1 was ever at during these
calculations i.e. during all these loops.
Is there any way to do this WITHOUT using another macro?
Everything I've tried so far just leads to *circular cell reference* errors.

TIA
Barry


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Dynamic Maximums

Hi Barry

Sub test()
Dim Dmax As Double, L As Long
Randomize
With Range("A1")
For L = 1 To 5000
.Value = Rnd() * 10000
If .Value Dmax Then Dmax = .Value
Next
End With

MsgBox "Max value was " & Dmax

End Sub

HTH. Best wishes Harald

"Barry" skrev i melding
...
A macro runs until a certain cell = *x*.
For each loop a new numeric value is calculated in A1.
I need to know the maximum value that A1 was ever at during these
calculations i.e. during all these loops.
Is there any way to do this WITHOUT using another macro?
Everything I've tried so far just leads to *circular cell reference*

errors.

TIA
Barry




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Dynamic Maximums

Try this:

In your declarations:

Dim A1LoopMax As Double

and as the first line in your loop:

A1LoopMax = Application.Max(A1LoopMax, Range("A1").Value)


-----Original Message-----
A macro runs until a certain cell = *x*.
For each loop a new numeric value is calculated in A1.
I need to know the maximum value that A1 was ever at during these
calculations i.e. during all these loops.
Is there any way to do this WITHOUT using another macro?
Everything I've tried so far just leads to *circular cell reference* errors.

TIA
Barry


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Dynamic Maximums

Just store it in B1 if it is greater than the value already in B1 (or some
other cell).

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Barry" wrote in message
...
A macro runs until a certain cell = *x*.
For each loop a new numeric value is calculated in A1.
I need to know the maximum value that A1 was ever at during these
calculations i.e. during all these loops.
Is there any way to do this WITHOUT using another macro?
Everything I've tried so far just leads to *circular cell reference*

errors.

TIA
Barry




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Maximums

Thanks for your responses but I need to do this without using another macro.
Barry
"Barry" wrote in message
...
A macro runs until a certain cell = *x*.
For each loop a new numeric value is calculated in A1.
I need to know the maximum value that A1 was ever at during these
calculations i.e. during all these loops.
Is there any way to do this WITHOUT using another macro?
Everything I've tried so far just leads to *circular cell reference*

errors.

TIA
Barry






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Dynamic Maximums

"Barry" skrev i melding
...
Thanks for your responses but I need to do this without using another

macro.
Barry


That's silly. Post your one-and-only macro then, so we have a chance to
modify it.

Best wishes Harald


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Dynamic Maximums

Why get all uptight with the guy [Barry] - all he's asking is *Is it
possible WITHOUT using another macro*; just as he said in his original post.
If it's not then say so.

Craig

"Harald Staff" wrote in message
...
"Barry" skrev i melding
...
Thanks for your responses but I need to do this without using another

macro.
Barry


That's silly. Post your one-and-only macro then, so we have a chance to
modify it.

Best wishes Harald




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Dynamic Maximums

"Craig" skrev i melding
...
Why get all uptight with the guy [Barry] - all he's asking is *Is it
possible WITHOUT using another macro*; just as he said in his original

post.
If it's not then say so.


Hi Craig.

The suggestions provided show how to do it within the existing macro. But if
yes/no are the only acceptable answers then yes.

Best wishes Harald


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Dynamic Maximums

Craig,

We (and I include Harald here, hopefully with his agreement) do not haunt
these NGs simply to answer a question posed. We feel we have a right, even
a duty in some ways, to question what we consider to be an inappropriate
approach, or even question a 'silly' comment. Harald was correct, if it
wasn't a silly statement, kin seeking a reason before expending his energy
on seeking a solution .

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Craig" wrote in message
...
Why get all uptight with the guy [Barry] - all he's asking is *Is it
possible WITHOUT using another macro*; just as he said in his original

post.
If it's not then say so.

Craig

"Harald Staff" wrote in message
...
"Barry" skrev i melding
...
Thanks for your responses but I need to do this without using another

macro.
Barry


That's silly. Post your one-and-only macro then, so we have a chance to
modify it.

Best wishes Harald






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
Vlookup maximums Mike P[_2_] Excel Worksheet Functions 1 January 13th 09 07:51 PM
conditional maximums Carlos Excel Worksheet Functions 1 June 17th 08 03:22 PM
Row Maximums in Charts TKERAC Charts and Charting in Excel 1 August 24th 07 02:33 PM
IF maximums B G Excel Worksheet Functions 5 July 27th 06 01:41 PM
Calculating Maximums L Buchy Excel Programming 5 September 26th 03 02:12 AM


All times are GMT +1. The time now is 10:23 AM.

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

About Us

"It's about Microsoft Excel"