Highest number in array

How to find the Highest number in array

Highest number in array

Dim Num, i, ArrayLength

Num = Array(1,3,4,2)

ArrayLength = Ubound(Num)

For i = 1 To ArrayLength

If (Num(i) > Num(0)) Then

Num(0) = Num(i)

End If

Next

Msgbox Num(0)