Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
value in the 1st col of a range
Dear Friends,
How can I check whether a value A exists in a range and specially i 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, -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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/ . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
value in the 1st col of a range
Dim rng As Range
Dim oCell As Range Set rng = Range("A1:H100") Set oCell = rng.Columns(1).Find("a") If Not oCell Is Nothing Then MsgBox oCell.Address End If and Dim ref Dim rng As Range Set rng = Range("A1:H100") ref = "a" MsgBox Application.VLookup(ref, rng, 5, 0) -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "banavas " wrote in 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/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Selecting range in list of range names depending on a cell informa | Excel Discussion (Misc queries) | |||
Range.Find returns cell outside of range when range set to single cell | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |