need help on inner loop

J

Janis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top