title: Excel VBA: cannot Sum() over Range()
body: <p>How should I fix this code because it throws: "The object doesn't support this property or method"</p>
  
  <pre><code>Sub macro1()
      Workbooks("OUTPUT.xls").Sheets("Sheet1").Activate
      ActiveSheet.Range("B4") = _ 
      Workbooks("INPUT.xlsx").Sheets("Sheet1").Sum(Range("D40:D50"))
  End Sub
  </code></pre>
  
  <p>Above code works fine when adjusted as:</p>
  
  <pre><code>Sub macro2()
      Workbooks("OUTPUT.xls").Sheets("Sheet1").Activate
      ActiveSheet.Range("B4") = _
      Workbooks("INPUT.xlsx").Sheets("Sheet1").Range("D40")
  End Sub
  </code></pre>
  
  <p>However it's not acceptable solution because I want to Sum() over Range() as described in macro1().</p>