PDA

View Full Version : Solved: search for multiple characters in a cell



papaz
08-04-2008, 09:26 AM
Hi all,

I have this data listed in one column and as a part of my code,
I have been trying to highlight the ones that have more than one comma in it.
So, 2nd and 6th rows are the points of interest.
I managed to highlight all of the cells with a comma in it; however,
I failed :banghead: to narrow this search down.
:help please...


( 603780, 603782 )
( 707264, 707266, 707697, 707699, 707702, 707704 )
( 1017 - 1032 )
( 343261 - 343280, 343333 - 343392 )
( 100057 )
( 10782, 10783, 10786, 10787, 10789 )

mdmackillop
08-04-2008, 10:58 AM
Sub Commas()
Dim cel As Range
For Each cel In Selection
If UBound(Split(cel, ",")) > 1 Then
cel.Interior.ColorIndex = 35
End If
Next
End Sub

papaz
08-04-2008, 11:19 AM
Thank you very much :)
that is perfect for my code, clear and logical.