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
Printable View
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.Code:Sub GetMaxVal()
Dim lMax As Long
lMax = WorksheetFunction.Max(Range("A:B"))
End Sub
I hope this helps!
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!
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.
This is for having a knowledge SamT.
Thanks