转帖自wxy_xiaoyu(☆然也☆╭∩╮(︶︿︶)╭∩╮)的答案
http://expert.csdn.net/Expert/topic/1511/1511641.xml?temp=.9079553
Dim M(1 To 5) As DoublePrivate Sub Form_Load()
    For i = 1 To 5
        M(i) = i
    Next
End Sub   Public Function Max(ByRef SZtmp) As Double
   Dim i%
     Max = 0
     For i = LBound(SZtmp) To UBound(SZtmp)
       If CDbl(SZtmp(i)) > Max Then _
         Max = CDbl(SZtmp(i))
         Me.Print Max
     Next i
   End FunctionPrivate Sub Command1_Click()
    Call Max(M)
End Sub