title: Passing range objects to functions in excel-vba -- receive "Object Required" error
body: <p>I'm trying to build a function that will take an input cell (say "B5") and return a range object that refers to a table (of which the supplied cell is the top-right entry)</p>
  
  <pre><code>Sub Macro1()
  Dim testCell As Range
  
  testCell = Worksheets("HMA").Range("B5")
  ReturnTable testCell
  
  End Sub
  
  Function ReturnTable(cell As Range)
      firstcell = cell
      lastrow = firstcell.End(x1Down)
      Table = Range(firstcell, lastrow + 5).Value
  End Function
  </code></pre>
  
  <p>I've been running into a lot of problems here, and I feel like I'm missing something simple. The error that I'm getting is "Object Required" at the lastRow line.</p>
  
  <p>Looking through it in debug mode I see that testCell is assigned the value of the range object (I assume this is the default). What am I missing here? </p>
  
  <p>Is my approach even sound? Should I be looking at solving this problem in a different way?</p>