title: get cell color in VBA and copy it into a pie-chart
body: <p>Could somebody possibly tell me a simple and straightforward way to read the colour of a cell in a worksheet into VBA and then to use this RGB code or what ever to colour a part of a pie chart? </p>
  
  <p>I'm trying </p>
  
  <pre><code>    Function rgb_color(cl As Range) As String
  Dim rgbc As Long, rc As Long, gc As Long, bc As Long
  If cl.Cells.Count = 1 Then
  rc = cl.Interior.Color Mod 256
  rgbc = Int(cl.Interior.Color / 256)
  gc = rgbc Mod 256
  bc = Int(rgbc / 256)
  Else
  End If
  End Function
  
  Sub ColorScheme(cht As Chart, i As Long)
  
      Dim Colors
  
      Select Case i Mod 10
          Case 0
          rgb_color (C2)
          rgb_color (C3)
          rgb_color (C4)
  </code></pre>
  
  <p>So the first part is the function  that gets the RGB code from the cell and I have a variety of charts to color which is the reason I chose different case statements. I know that I could manually do the RGB colours if needed but is there a simple way to use the different rc,bc,gc variables for each of the three cells (C2 to C4) as RGB values? It would look like an array </p>
  
  <pre><code>RGB(rc of C2; gc of C2; bc of C2)
  same for C3 and C4
  </code></pre>
  
  <p>then the next case with the same procedure?</p>
  
  <p>''######################################################
  EDIT from Tim's comment </p>
  
  <p>If I got Tim (comment below) correct I could write </p>
  
  <pre><code>Sub ColorScheme(cht As Chart, i As Long)
  
          Dim Colors
  
          Select Case i Mod 10
          Case 0 
  ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1).Points(x).Format.Fill.For‌eColor.RGB = Range("A1").Interior.Color
  </code></pre>
  
  <p>could somebody potentially correct me if that's wrong?</p>