title: Error 91 - Object Not Set
body: <p>This is a continuation of posting <a href="https://stackoverflow.com/questions/12772920/getting-error-91">#12772920</a> pertaining to error 91. Okay, here's the situation.
  (1) If this line is commented out, then (2) produces error 91. If not commented out, the code runs fine. 
  (3) This should point the public obj shCompanies to the "Companies" sheet, shouldn't it? I'm confused why this line doesn't seem to set the shCompanies object the way that (1) does. </p>
  
  <pre><code>Option Explicit
  Public wbCode As Workbook
  
  Public Sub Main()
     Dim tables As New CTables
     Set wbCode = ThisWorkbook
     Call SetExcelObjects
     (2)Call tables.Indexing
  End Sub
  
  Public Sub SetExcelObjects()
     Dim tables As New CTables
     (3)Set tables.shCompanies = wbCode.Worksheets("Companies")   
  End Sub
  
  
  ---Class Module CTables
  Option Explicit
  Public shCompanies As Worksheet
  
  Public Sub Indexing()
     Dim rng As Long
     Dim tables As New CTables
     (1)Set tables.shCompanies = wbCode.Worksheets("Companies")
     rng = tables.shCompanies.UsedRange.Rows.Count
  End Sub
  </code></pre>