title: vba import cells from other workbooks error
body: <p>I am trying to copy some range of cells from other workbooks, but I get the error:</p>
  
  <pre><code>'runtime '1004' error 
  Error defined by application or object
  </code></pre>
  
  <p>if I try to use the "range(cells(i,j), cells(k,h))" sintax instead of the range("A1:Z1"). I.e., In the following code the line "PASTE 1" produces an error, while the line "PASTE 2" runs smoothly (obviously I don't want to use the second one because I need to run a loop over different ranges). </p>
  
  <pre><code>Sub Importa()
  
  Dim directory As String
  Dim fileName  As String
  Dim wbfrom    As Workbook
  Dim wbto    As Workbook
  
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  
  directory = "mydirectory"
  fileName = Dir(directory &amp; "*.xl??")   'find the first *.xl?? file; '  wildcards: multiple character (*) single character (?)
  Set wbto = ThisWorkbook
  Set wbfrom = Workbooks.Open(directory &amp; fileName, False, True)
  
  ' copy some cells
  wbfrom.Sheets(1).Range(Cells(9, 6), Cells(15, 6)).Copy
  
  'PASTE 1
  wbto.Sheets(1).Range(Cells(9, 1), Cells(15, 1)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
  
  'PASTE 2
  'wbto.Sheets(1).Range("A1:A8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
  
  
  wbfrom.Close SaveChanges:=False
  'Turn on screen updating and displaying alerts again
  Application.ScreenUpdating = True
  Application.DisplayAlerts = True
  
  End Sub
  </code></pre>