need max of 6 values function

I need a function that accepts six integer parameter and returns maximum value of the six parameters.
campbe07Asked:
Who is Participating?
 
rettiseertCommented:
is this homework?

Function Max(Val1, Val2, Val3, Val4, Val5, Val6)

    Dim V(1 To 6)
    Dim i As Long
   
    V(1) = Val1
    V(2) = Val2
    V(3) = Val3
    V(4) = Val4
    V(5) = Val5
    V(6) = Val6
   
    For i = 1 To 6
        If V(i) > Max Then Max = V(i)
    Next

End Function
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.