Cannot Find Value with Carriage Return

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
I am using the following line of code to search for the specific term "Percent WGKFailure". When I look at the value in the cell itself, there appears to be a carriage return or vbcrlf between "WGK" and "Failure", since it spans two lines.

I search for that specific term using the following:


VBA Code:
    Set fnd = .Cells.Find("Percent WGKFailure", LookIn:=xlValues, LookAt:=xlWhole)

I have tried breaking that code up into multiple iterations, including "Percent WGK" & vbcrlf & "Failure", "Percent WGK" & vbnewline & "Failure", etc.

For some reason the code won't find that term. I would use just the "Percent WGK", but there is another column with that in it that can't be deleted.

Any idea how I can modify that particular line to look for the right combination?
 
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
The formula in Post #5 should have removed the double spacing...but glad you got it sorted. (y) (y)
 
Upvote 0

Forum statistics

Threads
1,215,844
Messages
6,127,245
Members
449,372
Latest member
charlottedv

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