#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Range Find

I am using the Find method of Range.
Do you have to find whole strings of the cell?
I am sending in a filename. But my cell contains full path. and it is not
finding the cell.
For example:

Cell:
C:\foo\foo\foo\myfile.doc

and my code is this:
Set objFind = objSheet.Range(strRange).Find(what:=Trim$("myfile. doc"),
LookIn:= _
xlFormulas, lookat:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False)

Do you need to find full strings?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Range Find

See the VBA help

You can use
xlPart

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"greg" wrote in message ...
I am using the Find method of Range.
Do you have to find whole strings of the cell?
I am sending in a filename. But my cell contains full path. and it is not
finding the cell.
For example:

Cell:
C:\foo\foo\foo\myfile.doc

and my code is this:
Set objFind = objSheet.Range(strRange).Find(what:=Trim$("myfile. doc"),
LookIn:= _
xlFormulas, lookat:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False)

Do you need to find full strings?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Range Find

Take a look in VBA Help for the Find function. Specifically, the
"LookAt" argument...

In article ,
"greg" wrote:

I am using the Find method of Range.
Do you have to find whole strings of the cell?
I am sending in a filename. But my cell contains full path. and it is not
finding the cell.
For example:

Cell:
C:\foo\foo\foo\myfile.doc

and my code is this:
Set objFind = objSheet.Range(strRange).Find(what:=Trim$("myfile. doc"),
LookIn:= _
xlFormulas, lookat:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False)

Do you need to find full strings?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Range Find

Hi
Substitute

LookAt:=xlWhole

with

LookAt:=xlPart

Regards,
Per

"greg" skrev i meddelelsen
...
I am using the Find method of Range.
Do you have to find whole strings of the cell?
I am sending in a filename. But my cell contains full path. and it is
not finding the cell.
For example:

Cell:
C:\foo\foo\foo\myfile.doc

and my code is this:
Set objFind = objSheet.Range(strRange).Find(what:=Trim$("myfile. doc"),
LookIn:= _
xlFormulas, lookat:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False)

Do you need to find full strings?



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
Find Last cell in Range when range is date format default105 Excel Discussion (Misc queries) 5 July 7th 09 03:11 PM
Find End in Undefined Range Select Range Trim SteveT Excel Programming 4 November 29th 07 06:54 PM
VBA REQUIRED TO TAKE VALUE FROM EACH CELL FROM A RANGE AND FIND THE VALUE FROM A DIFFERENT RANGE CAPTGNVR Excel Programming 2 July 5th 07 08:13 PM
Find the POSITION IN A RANGE of text in a string that matches value(s) in a range Cornell1992 Excel Programming 0 March 14th 06 07:19 PM
Find dates in a range; then sum values in that range by a criteria Anders Excel Discussion (Misc queries) 4 October 21st 05 03:41 PM


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