search with text containing carriage return

abenitez77

Board Regular
Joined
Dec 30, 2004
Messages
149
I am trying to search for something on the spreadsheet. my code to search is below. the text I am searching for is this :

"COST REQUEST
EFF. DATE"

Code:
 Set FoundCell = SearchRange.Find(What:="COST REQUEST EFF.Date", _
            After:=LastCell, _
            LookIn:=-4163, _
            LookAt:=1, _
            SearchOrder:=2, _
            MatchCase:=MatchCase)

I think there is a hidden symbol ...either carriage return or line feed after "COST REQUEST" but when I put a vbCrLf in my search (ie. "Cost Request" & vbcrlf & "EFF.Date"
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Not to be too picky as I am not too sure how this affect things but the full stop after EFF seems to be one stop forward in the search
 
Upvote 0
You are saying you are looking for "COST REQUEST
EFF. DATE"

But you are searching for"COST REQUEST EFF .DATE
The full stop is in a different place
 
Upvote 0
But you are searching for"COST REQUEST EFF .DATE
The full stop is in a different place
Actually, the OP's code is searching for "COST REQUEST EFF.Date" so it is not so much that the full stop is in a different place but that the description of what they are searching for includes a space whereas the code search does not.
 
Upvote 0
Actually, the OP's code is searching for "COST REQUEST EFF.Date" so it is not so much that the full stop is in a different place but that the description of what they are searching for includes a space whereas the code search does not.

I tried putting a vbrlf but that did not help.
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,657
Latest member
giadungthienduyen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top