title: Excel VBA SQL - multiple data sources in tab to do CHARTS
body: <p>I have a problem with my code in VBA. I have a Excel witch have A column (date), and B,C,D,E. ¿How i can read multiple source data from one Excel to do 4 charts?</p>
  <p>The four charts will be:</p>
  <ul>
  <li>Column A and Column B</li>
  <li>Column A and Column C</li>
  <li>Column A and Column D</li>
  <li>Column A and Column E</li>
  </ul>
  <pre class="lang-vb prettyprint-override"><code>Option Explicit
  
  Sub Pass_CSV_to_xlsx()
      
    Dim sCSVFullName As String, sWbkFullName As String, sFileRoot As String
    Dim wb As Workbook, ws As Worksheet
    Dim sTemp As String
    
    ' 1. Get CSV file name
    sCSVFullName = &quot;C:\Users\sergi\Desktop\Python\search_trends.csv&quot;
  
    ' 2. Open CSV file
    Workbooks.Open sCSVFullName
    Set wb = ActiveWorkbook
    
    ' 3. Save as workbook
    sFileRoot = Left$(sCSVFullName, InStrRev(sCSVFullName, &quot;.&quot;) - 1)
    sWbkFullName = sFileRoot &amp; &quot;.xlsx&quot;
    wb.SaveAs sWbkFullName, xlWorkbookDefault
    
    ' 4. Parse file
    Set ws = wb.Worksheets(1)
    
    ' 5. Insert and populate chart
    With ws.Shapes.AddChart.Chart
    
      '' chart type
      .ChartType = xlLineMarkers
      
      '' chart data
      .SetSourceData Source:=ws.UsedRange
      
    End With
    
      ActiveSheet.ChartObjects(&quot;Gráfico 1&quot;).Activate
      With ActiveSheet.Shapes(&quot;Gráfico 1&quot;)
          .Width = 750
          .Height = 215
          .Left = 0
      End With
    
      ' 6. Save file
      wb.Save
      
  End Sub
      ActiveSheet.ChartObjects(&quot;Gráfico 1&quot;).Activate
      With ActiveSheet.Shapes(&quot;Gráfico 1&quot;)
          .Width = 750
          .Height = 215
          .Left = 0
      End With
    
      ' 6. Save file
      wb.Save
      
  End Sub
  </code></pre>