Hello,
I have started a small code in VBA but can't get this simple loop to work. I am creating a UDF function with multiple input Ranges.
I then want to loop in those ranges but VBA don't seem to recognize the ranges.
Here is the code:
Function NPak(Lookup As Variant, ORange1 As Range, ORange2 As Range, ORange3 As Range, ORange4 As Range)
Dim InputRange(1 To 4) As Range
Dim I As Integer
On Error Resume Next
For I = 1 To 4
If Not IsMissing(ORange & I) Then
Set InputRange(I) = (ORange & I)
Else
Exit For
End If
Next I
End Function
Please help!
I have started a small code in VBA but can't get this simple loop to work. I am creating a UDF function with multiple input Ranges.
I then want to loop in those ranges but VBA don't seem to recognize the ranges.
Here is the code:
Function NPak(Lookup As Variant, ORange1 As Range, ORange2 As Range, ORange3 As Range, ORange4 As Range)
Dim InputRange(1 To 4) As Range
Dim I As Integer
On Error Resume Next
For I = 1 To 4
If Not IsMissing(ORange & I) Then
Set InputRange(I) = (ORange & I)
Else
Exit For
End If
Next I
End Function
Please help!