• Notice regarding image hosts and attachments. See here.

Yet another Excel VBA question....

Soldato
Joined
18 Oct 2002
Posts
7,514
Location
Maidenhead
Hi all,

Whats the easiest way for me to do this?

I have a list of values in column A and column B. I need to search down column A for a specific value, and return the value in the same row from column B... ie

Value to find D

A 1
B 2
C 3
D 4
E 5
F 6

Result = 4

(nb they are not the actual values :))

TIA
 
If I understand the question, the easiest way I'd have thought would be something like this:

Code:
searchfor = "d"
Range("a1").Select
Do While ((ActiveCell.Value <> searchfor) And (ActiveCell.Row < 1000))
ActiveCell.Offset(1, 0).Select
Loop
valuetoreturn = ActiveCell.Offset(0, 1).Value
 
Back
Top Bottom