I'm trying to create a super VLOOKUP function in VBA and I've gotten it to work fine within the same sheet but i can't seem to figure it out for getting it to work across other books.
Basically this function takes three arguments: Lookup Value, Lookup Table and Return Column.
Lookup value is used to match against every cell within the lookup table and when a match is found, it will return the value from the cell in Return Column at the matched cells row.
Here is my code:
Function SUPERLOOKUP(lv As Range, lt As Range, rc As Range)
Dim cell As Range
Dim output As String
For Each cell In lt
If cell.Value = lv Then
output = output & Range(ColumnLetter(uRC.Column) & cell.Row).Value & ", "
End If
Next cell
SUPERLOOKUP = Left(output, Len(output) - 2)
End Function
ColumnLetter is a function i use to convert the column number to it's letter value.
Any help is appreciated or even to be pointed in the right direction.