View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default value in the 1st col of a range

You need to study what objects are. Look in Help for find.

Where you use Find as a range object method, then it
returns a range opject. You cannot use msgbox for a range
object....you need to specify WHAT property you
want...and in this cas eyou'd use Value.

DIM Result As Range
SET Result = Source.Find(What)
' source is the range that you want to search in
IF NOT Result is Nothing THEN
' Result is a range object that has the value that you
' searched for
msgbox "Found in " & Result.Address
END IF


Passing reference to functions is one of the most basic
things to learn. Read HELP on Functions and procedures.

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Dear Friends,

How can I check whether a value A exists in a range and

specially in
the first column of the range?

I cannot figure out how does the rangeL.find() works.

msgbox(rangeL.Find(A)) breaks my code.

At last how can I pass a reference in a function?

ex.

VlookUp(ref, Range, 5, 0)

ref - the reference name of a value.

Thanks,
G


---
Message posted from http://www.ExcelForum.com/

.