title: Reading CSV file into excel using VBA then outputting the results to a specific worksheet
body: <p>I've been searching for a while and can't find a simple solution. I've got a csv file that I would like to read into excel using vba and output the results into a specific cell range on a specific worksheet.</p>
  
  <p>I've been using the following code, but if I run the excel macro twice it basically appends the data on the next blank column instead of copying over it. It also only pastes it into the active sheet instead of my specific sheet.</p>
  
  <p>Any suggestions on how I can do this?</p>
  
  <p>Thanks,</p>
  
  <pre><code>Public Sub Example()
      Const csPath As String = "starting_positions.csv"
      Dim ws As Excel.Worksheet
      Set ws = Excel.ActiveSheet
      With ws.QueryTables.Add("TEXT;" &amp; csPath, ws.Cells(1, 1))
          .FieldNames = True
          .AdjustColumnWidth = True
          .TextFileParseType = xlDelimited
          .TextFileTextQualifier = xlTextQualifierDoubleQuote
          .TextFileConsecutiveDelimiter = False
          .TextFileCommaDelimiter = True
          ''// This array will need as many entries as there will be columns:
          .TextFileColumnDataTypes = Array(xlTextFormat, xlTextFormat)
          .Refresh
      End With
  End Sub
  </code></pre>