![]() |
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 |
need help on inner loop
I found some problems so I will repost. please help.
"Janis" wrote: 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 |
All times are GMT +1. The time now is 12:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com