View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Janis Janis is offline
external usenet poster
 
Posts: 360
Default need help on inner loop

I have one string in cell R I want to loop through all the cells in J and if
it finds it color it red. The problem is there could be one or two strings
in J separated by a column. I think I have the first loop right but I don't
know how to loop through the strings in J?

tia,

Dim ColumnJ As Range
Dim ColumnR As Range
StringToSearch As String

I As Integer
C As Cell

Set ColumnJ = ActiveSheet.Range("J:end.xl(down)")
Set ColumnR = ActiveSheet.Range("R:end.xl(down)")

I = 2

For Each C In ColumnR

C = ColumnR: I



'compare cell in ColumnR with each string in ColumnJ
For each stringToSearch in Column J
if stringToSearch = C

'if it matches color font red
C.Font.ColorIndex = 3
Else
Next

End If
I = I + 1