#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Searching

I use a macro that searches a spresdsheet for cells containing certain text.
I use the find like this:

..Cells.Find("GBP", LookIn:=xlValues)

the "GBP" is supposed to be unique in the spreadsheet in the sens that on
that worksheet only one cell has exactly that text. However other cells have
text like:
"Float GBP" or GBP(index)" and this causes problems becuase then the find
function does not always find the correct cell. I know it is possible to
change in the spreadsheet but I keep getting new info and it is not possible
to change it all manually. Is there any way of doing this, I mean search for
a unique cell content? I would be most grateful for any assistance. Thank you
very much!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Searching

Hi Victor,

Try

'=============
Public Sub Tester()
Dim rng As Range
Const sStr As String = "GBP"

Set rng = ActiveSheet.UsedRange

Set rng = Cells.Find(What:=sStr, _
After:=rng(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.Select
Else
MsgBox "Unable to find """ & sStr & """"
End If

End Sub
'<<=============

--
Regards,
Norman



"Viktor Ygdorff" wrote in message
...
I use a macro that searches a spresdsheet for cells containing certain
text.
I use the find like this:

.Cells.Find("GBP", LookIn:=xlValues)

the "GBP" is supposed to be unique in the spreadsheet in the sens that on
that worksheet only one cell has exactly that text. However other cells
have
text like:
"Float GBP" or GBP(index)" and this causes problems becuase then the find
function does not always find the correct cell. I know it is possible to
change in the spreadsheet but I keep getting new info and it is not
possible
to change it all manually. Is there any way of doing this, I mean search
for
a unique cell content? I would be most grateful for any assistance. Thank
you
very much!



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
Set Up Searching FC Setting up and Configuration of Excel 0 October 7th 07 01:21 AM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
searching Tracy A Excel Worksheet Functions 2 July 28th 05 08:54 PM
searching for a value... Tony Zappal Excel Programming 0 November 18th 04 12:45 AM
Searching LC[_3_] Excel Programming 1 July 25th 03 12:29 AM


All times are GMT +1. The time now is 04:56 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"