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
Post a Comment