Friday, July 8, 2011

How to Use ParamArray :


Use of ParamArray :-

Param array is the collection of variant type variable : its allow to pass Voluntarily Variable to a Function, See the Below Mention Ratio Function, We can give any number of Arguments to this Function and can get Ratio:


Function Ratio(ParamArray arr()) As String
Dim Arr2(1) As Integer
        For i = 0 To UBound(arr)
            Ratio = Ratio & arr(i) / WorksheetFunction.Gcd(arr) & ":"
        Next
        Ratio = Left(Ratio, Len(Ratio) - 1)
End Function

No comments: