Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tig tig is offline
external usenet poster
 
Posts: 10
Default Search for text value in range

I'm looking for an efficient method to search for a text value. I have
a named range. Let's say range = A7:A14. I want to check cells C7:C14
to find the first cell whose value matches a previously populated
variable. It's possible that none of the cells have that value in it.

It seems that I could use a for all loop but I can't seem to get the
syntax right. I've already got a ton of named ranges. I'm trying to
avoid setting up a bunch more.

Any ideas??

TIA

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Search for text value in range

Tig, I don't know if this is what your looking for, but give this code a
shot.

hth , Rick


Sub FindDup()
Dim dupRng As Range, fndRng As Range
Dim x As Long


Set dupRng = Range("A7:A14")
x = 7 '' start row
Do Until IsEmpty(Cells(x, "C").Value)
Set fndRng = dupRng.Find(what:=Cells(x, "C").Value)
If Not fndRng Is Nothing Then
MsgBox ("Duplicate Found at = " & fndRng.Address)
Exit Sub
End If
x = x + 1
Loop

MsgBox ("No Duplicates Found")

End Sub




"tig" wrote in message
oups.com...
I'm looking for an efficient method to search for a text value. I have
a named range. Let's say range = A7:A14. I want to check cells C7:C14
to find the first cell whose value matches a previously populated
variable. It's possible that none of the cells have that value in it.

It seems that I could use a for all loop but I can't seem to get the
syntax right. I've already got a ton of named ranges. I'm trying to
avoid setting up a bunch more.

Any ideas??

TIA



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
Search for specific text within last non blank cell in a range Bevo Excel Worksheet Functions 2 September 5th 09 08:15 AM
Search for Condition, Text based, Date Range, Occurrences NickNameGoesHere Excel Worksheet Functions 1 March 18th 08 04:11 PM
Search range for text not in another range simon howard Excel Discussion (Misc queries) 3 March 28th 07 08:44 PM
Search Range for item in seperate range [email protected][_2_] Excel Programming 6 January 9th 06 03:53 PM
Can Range.Find search a Cells' Text property? clarence_rollins Excel Programming 2 August 25th 03 12:20 AM


All times are GMT +1. The time now is 06:33 PM.

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"