Big Help Needed: Search for Value w/ Code- Cell is formula

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,968
Here is a simple loop that I want to find any values w/ a dash in them.
The issue is the cells are still in Formula and I cannot make them values first. So I need to find a way of searching in the cell for this value while it remains as a formula. Possible I hope.

This works as long as the cell values are values, but fails if formula.
Code:
For i = 4 To 6 'LRowf
If Cells(i, "M").Text Like "*-" Then
Cells(i, "M").Interior.Color = vbYellow
End If
Next i
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
J-
What about If InStr, could that work?
The value could be 1 or 2 from left or right, e.g., 7-8, 9-10, 10-11 something like that.
I will do some research....
 
Upvote 0
In that case

InStr
Code:
If InStr(Cells(k, "M").Value, "-") > 0
or
Like operator
Code:
If Cells(i, "M").Value Like "*-*"
 
Upvote 0
Jindon,
I don't know how you have any time to do your own work--- you are always helping us
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,031
Members
448,940
Latest member
mdusw

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