title: How to change default colors used in VBA code/Macro result (Red, Green)
body: <p>I am using the following VBA code to change the color of the rows in my spreadsheet every time the value in Column A changes (So that all entries with the same value in column A will be grouped by color. The spreadsheet is sorted by column A already so  the items are already grouped, I just needed them colored). </p>
  
  <p>Anyway, when I run this macro the rows are colored red &amp; green (which are very bright and overwhelming colors for this purpose). I need something more subtle.. </p>
  
  <p>How do I change this? Or can I specify in my VBA code for it to use certain colors by rgb or color index? {I am using Excel 2007}</p>
  
  <pre><code>Sub colorize() 
  
  Dim r As Long, val As Long, c As Long 
  
  r = 1 
  val = ActiveSheet.Cells(r, 1).Value 
  c = 4 
  
  For r = 1 To ActiveSheet.Rows.Count 
      If IsEmpty(ActiveSheet.Cells(r, 1).Value) Then 
          Exit For 
      End If 
  
      If ActiveSheet.Cells(r, 1).Value &lt;&gt; val Then 
          If c = 3 Then 
               c = 4 
          Else 
              c = 3 
          End If 
      End If 
  
      ActiveSheet.Rows(r).Select 
      With Selection.Interior 
          .ColorIndex = c 
          .Pattern = xlSolid 
      End With 
  
      val = ActiveSheet.Cells(r, 1).Value 
  Next 
  
  End Sub 
  </code></pre>