VBA突出显示行

我正在尝试创build一个代码来遍历一个Excel文档。 我想让macros根据我检查的单元格左边的值突出显示所有的行。 这是我想说的,但不能在代码中正确。

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 

请帮忙,谢谢。

虽然我不能确定,但​​我相信你想像这样翻译你的伪代码

 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 

我正在读你吗?