title: Passing objects as parameters in Excel VBA
body: <p>How do I pass an object to a private sub as a reference in Excel VBA? Below is what I am trying to do:</p>
  
  <pre><code>Sub main()
      Dim r As Range
      Set r = Sheets("Sheet1").Range(Cells(1, 1), Cells(27, 27))
      r.Select 'this works
      select_cells (r) 'this doesn't work
  End Sub
  
  Private Sub select_cells(a As Range)
      a.Select 'prompts Object Required error
  End Sub
  </code></pre>