Function test(Rng1 As Range, Rng2 As Range, Rng3 As Range)
Dim iR&, ic%, arr, brr, crr
arr = Rng1
brr = Rng2
crr = Rng3
'--------------------------------------------------
iR = UBound(arr)
For i = 1 To iR
If arr(i, 1) > 11 Then
If brr(i, 1) > 22 Then
test = crr(i, 1)
Exit Function
End If
End If
Next i
End Function
使用Range.Cells属性,例如:
Function fun(rga as Range, rgb as Range, rgc as Range)
Dim i
For i=1 to rga.Cells.Count
If rga.Cells(i)=rgb.Cells(i) Then '这里的条件需要你自行完善
fun = rgc.Cells(i)
Exit Function
End If
Next i
End Function