Reputation: 13
I am trying to create a code to iterate over an excel document. I want the macro to highlight all rows based on the value to the left of the cell I am checking. This is what I'm trying to say, but can't properly in code.
For x = 4 to 3918
if (x,2) contains the letters "LW" then
look at (x,1)
highlight all rows with value = (x,1) green
Please help, thank you.
Upvotes: 0
Views: 856
Reputation: 5151
While I can't be sure, I believe you want to translate your pseudocode like so
for x = 4 to 3918
if Instr(cells(x, 2), "LW") then
numToFind = cells(x, 1)
for y = 4 to 3918
if cells(y, 1) = numToFind then
cells(y, 1).entirerow.Interior.ColorIndex = 4
end if
next y
end if
next x
Am I reading you right?
Upvotes: 1