Hi All,
I'm trying to get to grips with creating UDF's.
I have put the following together and it works fine if it's on the same sheet in the same
workbook but it won't work between two workbooks.
Any help as to what I'm doing wrong would be appreciated.
It's my version of a backward lookup where I can key in a negative number for coln.
Function Revlkup(Lval As Variant, rng1 As Range, coln As Integer)
Dim lval2 As Range
For Each lval2 In Range(rng1.Address)
If lval2 = Lval Then
Revlkup = lval2.Offset(0, coln)
Exit Function
Else
Revlkup = "No match found"
End If
Next lval2
End Function
Rgds
Nimo
I'm trying to get to grips with creating UDF's.
I have put the following together and it works fine if it's on the same sheet in the same
workbook but it won't work between two workbooks.
Any help as to what I'm doing wrong would be appreciated.
It's my version of a backward lookup where I can key in a negative number for coln.
Function Revlkup(Lval As Variant, rng1 As Range, coln As Integer)
Dim lval2 As Range
For Each lval2 In Range(rng1.Address)
If lval2 = Lval Then
Revlkup = lval2.Offset(0, coln)
Exit Function
Else
Revlkup = "No match found"
End If
Next lval2
End Function
Rgds
Nimo