Hi all,
I am trying to find and use the maximum value in VBA code. The maximum value is used to select a specific cell. Any help is appreciated. Thanks
Hi all,
I am trying to find and use the maximum value in VBA code. The maximum value is used to select a specific cell. Any help is appreciated. Thanks
Good morning bbuk9999,
You could setup a maximum variable and associate the maximum value in a range to that variable for further use.
Something along the lines of this...
Obviously change the range to suit.Sub GetMaxVal() Dim lMax As Long lMax = WorksheetFunction.Max(Range("A:B")) End Sub
I hope this helps!
-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-
12:45, restate my assumptions.
Mathematics is the language of nature.
Everything around us can be represented and understood through numbers.
If you graph the numbers of any system, patterns emerge. Therefore, there are patterns everywhere in nature.
-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-
Thanks for your help PAB,
Can you let me know to do this too use the Max value further? Thanks
It depends on what you are trying to do bbuk9999,
If you have a WorkBook, perhaps you could upload it or post a link to it so we can have a look, obviously take out any sensitive information first.
I hope this helps!
-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-
12:45, restate my assumptions.
Mathematics is the language of nature.
Everything around us can be represented and understood through numbers.
If you graph the numbers of any system, patterns emerge. Therefore, there are patterns everywhere in nature.
-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-∏-
Thanks PAB, please have a look at the attached file. I am trying to find the maximum value in the attached programme in sheet("Container Yard"), ans in the sheet 2 number 1 should be inserted in as shown in the attached file. by the way , the attached file is dynamic table in VBA. Thanks in advance.
How to choose the first maximum value if we have more than one with the same value? Thanks
Is this for homework or for production? It will make a difference in how I answer.
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
This is for having a knowledge SamT.
Thanks