Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"