VBA: Finding the largest value in array

  • Hi All,


    I am populating an array from a named range and I need to be able to return the Lowest and Highest values from the array. The number of elements may differ and the values may not always be in numerical order. Could someone please help me out with an example code or link to an example.


    Regards


    Ezzer...:spin:

  • I have to apologise for not giving enough info...


    Here is a sample of the data that fills the array that I am trying to get the max value from:


    A1780
    A1790
    A1800
    A1810
    A1850
    A1900


    I need to pass the value "A1900" from this example, is it possible?


    Regards


    Ezzer...:spin:

  • Hi Ezzer


    If you can sort the data you have shown, it would simple be:

    Code
    Sub MaxValue()
    MsgBox "Max is " & Range("A65536").End(xlUp)
    End Sub


    If not sorted and are preceded with others letters, use


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!