title: Macro to pull data from closed workbook to another workbook
body: <p>I am writing a macro to do the following:</p>
  
  <p>Every time I open a workbook, pull data from a closed workbook on my computer and copy that data to a sheet titled "Availability" starting in cell A1.</p>
  
  <p>Currently, all that happens is "TRUE" is put into cell A1 on the Availability sheet.</p>
  
  <p>Please help.</p>
  
  <pre><code>Sub OpenWorkbookToPullData()
  
      Dim sht As Worksheet
      Dim lastRow As Long
      lastRow = ActiveSheet.UsedRange.Rows.Count
      Set sht = ThisWorkbook.Worksheets(Sheet1.Name)
      Dim path As String
      path = "C:\users\" &amp; Environ$("username") &amp; _
      "\desktop\RC Switch Project\Daily Automation _
      Availability Report.xlsx"
  
      Dim currentWb As Workbook
      Set currentWb = ThisWorkbook
  
      Dim openWb As Workbook
      Set openWb = Workbooks.Open(path)
  
      Dim openWs As Worksheet
      Set openWs = openWb.Sheets("Automation Data")
  
      currentWb.Sheets("Availability").Range("A1") _
      = openWs.Range("A5:K" &amp; LastRow).Select
      openWb.Close (False)
  
  End Sub
  </code></pre>