vlookup lookup different column

  • Thread starter Thread starter tango
  • Start date Start date
T

tango

Dear Myrna,
I do not understand you. you see, if i follow my table column then i
will not get the value. originally the code is sitting in column B so
if in my vba i put B then i will not get anything. when i debug i
found out the code is sitting in column A. that is why in my vba i
refer to A and not B. do u see the point?
thanks alot





Because it's nearly impossible to figure out the layout from your
message --
where column A ends and column B begins. Where are the numbers? Column
C? You
don't mention column C.
 
Even I have experienced such problems and so I have started using my ow
lookup function instead. If you like, you can use it and see if it work
correctly.

---------------------------------------------------------------------------

Function my_Lookup(lookup_value, rng As Range, column_index A
Integer)

On Error GoTo Err_Handler

For i = 1 To rng.Rows.Count

If rng(i, 1) = lookup_value Then

my_Lookup = rng(i, column_index)
Exit Function

End If

Next

Exit_Handler:
Exit Function

Err_Handler:
Application.StatusBar = "Function: my_Lookup"
Debug.Print Err.Number & " " & Err.Description & " Function
my_Lookup"
Resume Exit_Handler

End Function
 
No, I'm sorry, but I don't. Code doesn't "sit in [a] column". It's in a
module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top