title: vba excel edit/add series and horizontal axis labels
body: <p>My Current code places three bar graphs in each section on the x axis. I wish to have three separate sections each with their own bar graph. <a href="https://i.stack.imgur.com/AsCVB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AsCVB.jpg" alt="enter image description here"></a>  here is my current code</p>
  
  <pre><code>Sub DrawChart1()
   Dim i As Long
   Dim j As Long
   Dim ws As Worksheet
   Dim rCht As Range, rYVals As Range
   Dim cht As Chart
  
   ' finding the number of rows
   Set ws = Worksheets("sheet1")
   'j = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
  
  
   'j = ws.Cells(9, 1).Row
   j = ws.Range(ws.Cells(1, 1), ws.Cells(1, 3)).Row
   ' start with X values (row 10 to j), include header row (row 9)
   Set rCht = ws.Range(ws.Cells(9, 1), ws.Cells(j, 1))
  
   Set rCht = ws.Range(ws.Cells(1, 1), ws.Cells(1, 3))
  
   ' add column of Y values if row 8 of column is TRUE
  ' For i = 2 To 14
    For i = 1 To 3
    If ws.Cells(8, 1).Value Then
    Set rYVals = ws.Range(ws.Cells(9, i), ws.Cells(9, i))
     '     Set rYVals = ws.Range(ws.Cells(9, 2), ws.Cells(9, 2))
  
       Set rCht = Union(rCht, rYVals)
     End If
   Next
  
     ' if we've had any Y values, insert chart, using range we've built up
      If Not rYVals Is Nothing Then
       Set cht = ws.Shapes.AddChart(xlColumn).Chart
      cht.SetSourceData Source:=rCht, PlotBy:=xlColumns
      End If
     End Sub
  </code></pre>