PDA

View Full Version : Solved: Find "/" in string & debug.print ?



YellowLabPro
09-23-2007, 03:51 PM
I am trying to find cell values w/ two slashes.
If it does, color it red.
Secondarily, I would like to use Debug.Print to tell me which row I am in whilst telling me the value, possible?


If c.Value = c.Value Like "*/*" & "*/*" Then
c.Interior.Color = vbRed
End If
Debug.Print c.Value
'Debug.Print Range(0, 0).Address
Next c


thx....

YellowLabPro
09-23-2007, 04:09 PM
Having the slashes in the middle of the term, not liking it to find it....
I also tried this:
If InStr(c, "*/*") > 0 Then

an example of the term I am looping through on is:
orange/purple/silver

Bob Phillips
09-24-2007, 12:52 AM
Dim c As Range

For Each c In Selection
If Len(c.Value) - Len(Replace(c.Value, "/", "")) = 2 Then
c.Interior.Color = vbRed
Debug.Print c.Row
End If
Next c

johnske
09-24-2007, 01:14 AM
I am trying to find cell values w/ two slashes.
If it does, color it red.
Secondarily, I would like to use Debug.Print to tell me which row I am in whilst telling me the value, possible?


If c.Value = c.Value Like "*/*" & "*/*" Then
c.Interior.Color = vbRed
End If
Debug.Print c.Value
'Debug.Print Range(0, 0).Address
Next c


thx....

Sub DoStuff()
'
Dim C As Range
'
For Each C In Selection
With C
If .Value Like "*/*/*" Then
.Interior.Color = vbRed
Debug.Print .Value
Debug.Print "Row " & .Row
End If
End With
Next
'
End Sub

YellowLabPro
09-24-2007, 04:34 AM
Thanks Bob,
Awesome & Perfecto!

Thanks John,
The text "Row " tip is really nice.

cheers and salute-

Doug