• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

VLOOKUP type function in VBA

I am writing some code. I want to have a function similar to VLOOKUP that will just return the column that contains a string that I pass.

For example, I  have the value "Part 123" and column A in my spreadsheet contains:
Part 1
Part 2
...
Part 122
Part 123
...

I want to be able to return the row containing the value Part 123. If the value is not found, then return something else (0, -1, #EEROR#). Is there a 'built-in' function that I can make use of from within VBA to do this within my macro?
0
dbbishop
Asked:
dbbishop
  • 2
  • 2
1 Solution
 
StephenJRCommented:
You can use the Find method.
0
 
StephenJRCommented:
Actually you can use the Match worksheet function.
0
 
dbbishopAuthor Commented:
Used Match as it returned an object that I could then work with directly (I have to set other values in specific columns. It is cleaner to me to work with the returned object.

Thank you.
0
 
dbbishopAuthor Commented:
Meant to say I used FIND.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now