excel vba - Macro to color code Cells that match Table with conditional formatting -


as title states, macro color code cells match table conditional formatting.

i take cells in column x, , have excel search table (likely on sheet/tab) , when finds result (there no non-results, exception of reaching end of column in sheet1) fill cell color and/or text color exists in table on sheet2.

i complete novice in coding , have no idea start. found result looked promising, not figure out how work:

sub matchandcolor()  dim lastrow long dim sheetname string      sheetname = "sheet1"            'insert sheet name here     lastrow = sheets(sheetname).range("a" & rows.count).end(xlup).row      lrow = 2 lastrow         'loop through rows          if sheets(sheetname).cells(lrow, "a") = sheets(sheetname).cells(lrow, "b")             sheets(sheetname).cells(lrow, "a").interior.colorindex = 3  'set color red         end if      next lrow  end sub 

this sheet values near 30-50 in table, matching sheet near 200 lines, if matters.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -