title: How to import a specific worksheet from an excel file?
body: <p>I'm using VBA Access 2010. Apparently, the excel file has 13 worksheets and I only need to get the columns from one worksheet. And also, if there's a way to skip the column headers, that would be helpful. Thank you.</p>
  
  <p>Here's the code I'm working on:</p>
  
  <pre><code>    stat.Caption = "Import Files"
      Me.Refresh
  
          If txtFileSource.Value &lt;&gt; "" Then
  
              Dim strTablename As String
              Dim xlsRpt As New Excel.Application
              Dim xbookRpt As New Excel.Workbook
              Dim iRowCountRpt As Integer
              Dim strRangeRpt As String
  
              If cmbData.Value = "My File" Then
  
  
                  Set xbookRpt = Workbooks.Open(txtFileSource.Value)
                  iRowCountRpt = xbookRpt.Sheets(1).UsedRange.Rows.Count
                  strRangeRpt = "A1:I" &amp; iRowCountRpt
                  DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_Account", txtFileSource.Value, True, strRangeRpt
                  xbookRpt.Close
                  xlsRpt.Quit
  
  
              End If
  
          cmbData.Value = "Select File"
          txtDestination.Value = ""
          txtFileSource.Value = ""
  
          Call DeleteImportErrorTables
          Call MsgBox("Import successful!", vbInformation, "Import File")
  
      End If
  
  stat.Caption = "Ready..."
  Me.Refresh
  </code></pre>