title: VBA copying data from one workbook to another
body: <p>Im just exploring the VBA and trying to use it for copying a selection of data from one workbook to another.
  The first book 'send' has information between A:D and the number of rows can change. The 'receiver' will have the information collected from many 'send' so this data needs to be copied in below the last information.
  I found this code below and modified it, but it give me a runtime 9 code and falls at
  ' lMaxRows_t' Any ideas or help much appreciated</p>
  
  <pre><code>    Sub CopyData()
  Dim sBook_t As String
  Dim sBook_s As String
  Dim sSheet_t As String
  Dim sSheet_s As String
  Dim lMaxRows_t As Long
  Dim lMaxRows_s As Long
  Dim sMaxCol_s As String
  Dim sRange_t As String
  Dim sRange_s As String
  sBook_t = "\\scceastfl5\~\tester receiver.xlsx"
  sBook_s = "\\scceastfl5\~\tester send.xlsx"
  sSheet_t = "Sheet1"
  sSheet_s = "Sheet1"
  lMaxRows_t = Workbooks(sBook_t).Sheets(sSheet_t).Cells(Rows.Count, "A").End(xlUp).Row
  lMaxRows_s = Workbooks(sBook_s).Sheets(sSheet_s).Cells(Rows.Count, "A").End(xlUp).Row
  sMaxCol_s = Workbooks(sBook_s).Sheets(sSheet_s).Cells(1, Columns.Count).End(xlToLeft).Address
  sMaxCol_s = Mid(sMaxCol_s, 2, InStr(2, sMaxCol_s, "$") - 2)
  If (lMaxRows_t = 1) Then
  sRange_t = "A1:" &amp; sMaxCol_s &amp; lMaxRows_s
  sRange_s = "A1:" &amp; sMaxCol_s &amp; lMaxRows_s
  Workbooks(sBook_t).Sheets(sSheet_t).Range(sRange_t) = Workbooks(sBook_s).Sheets(sSheet_s).Range(sRange_s).Value
  Else
  sRange_t = "A" &amp; (lMaxRows_t + 1) &amp; ":" &amp; sMaxCol_s &amp; (lMaxRows_t + lMaxRows_s - 1)
  sRange_s = "A2:" &amp; sMaxCol_s &amp; lMaxRows_s
  Workbooks(sBook_t).Sheets(sSheet_t).Range(sRange_t) = Workbooks(sBook_s).Sheets(sSheet_s).Range(sRange_s).Value
  End If
  End Sub
  </code></pre>