{"id":99,"date":"2013-12-13T08:12:40","date_gmt":"2013-12-13T08:12:40","guid":{"rendered":"http:\/\/tastaturkind.ch\/?p=99"},"modified":"2018-12-04T10:09:10","modified_gmt":"2018-12-04T09:09:10","slug":"update-excel-cells-with-color","status":"publish","type":"post","link":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/2013\/12\/13\/update-excel-cells-with-color\/","title":{"rendered":"Update Excel Cells with color"},"content":{"rendered":"<p><code><br \/>\nSub Update_Row_Colors()<\/p>\n<p>Dim LRow As Integer<br \/>\nDim LCell As String<br \/>\nDim LColorCells As String<br \/>\n'Start at row 7<br \/>\nLRow = 7<\/p>\n<p>'Update row colors for the first 2000 rows<br \/>\nWhile LRow &lt; 2000<br \/>\nLCell = \"C\" &amp; LRow<br \/>\n'Color will changed in columns A to K<br \/>\nLColorCells = \"A\" &amp; LRow &amp; \":\" &amp; \"K\" &amp; LRow<\/p>\n<p>Select Case Left(Range(LCell).Value, 6)<\/p>\n<p>'Set row color to light blue<br \/>\nCase \"007007\"<br \/>\nRange(LColorCells).Interior.ColorIndex = 34<br \/>\nRange(LColorCells).Interior.Pattern = xlSolid<\/p>\n<p>'Set row color to light green<br \/>\nCase \"030087\"<br \/>\nRows(LRow &amp; \":\" &amp; LRow).Select<br \/>\nRange(LColorCells).Interior.ColorIndex = 35<br \/>\nRange(LColorCells).Interior.Pattern = xlSolid<\/p>\n<p>'Set row color to light yellow<br \/>\nCase \"063599\"<br \/>\nRows(LRow &amp; \":\" &amp; LRow).Select<br \/>\nRange(LColorCells).Interior.ColorIndex = 19<br \/>\nRange(LColorCells).Interior.Pattern = xlSolid<\/p>\n<p>'Default all other rows to no color<br \/>\nCase Else<br \/>\nRows(LRow &amp; \":\" &amp; LRow).Select<br \/>\nRange(LColorCells).Interior.ColorIndex = xlNone<\/p>\n<p>End Select<\/p>\n<p>LRow = LRow + 1<br \/>\nWend<\/p>\n<p>Range(\"A1\").Select<\/p>\n<p>End Sub<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sub Update_Row_Colors() Dim LRow As Integer Dim LCell As String Dim LColorCells As String &#8218;Start at row 7 LRow = 7 &#8218;Update row colors for the first 2000 rows While LRow &lt; 2000 LCell = &#8222;C&#8220; &amp; LRow &#8218;Color will &hellip; <a href=\"https:\/\/oliver-frick.ch\/wordpress\/index.php\/2013\/12\/13\/update-excel-cells-with-color\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":2,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}