title: Proper procedure for declaring global variables in VBA?
body: <p>I have a macro workbook with a number of worksheets that exist permanently, which are constantly cleared, updated, etc. Since they are referred to in various subroutines, I have made each corresponding worksheet object a pseudo-global variable in the following manner, for example for the "Main" sheet:</p>
  
  <pre><code>    Function MAIN() As Worksheet
          Set MAIN = ThisWorkbook.Sheets("Main")
      End Function
  </code></pre>
  
  <p>By doing so, I can then refer to each sheet in the other subroutines, for example: </p>
  
  <pre><code>    MAIN.Cells.ClearContents
  </code></pre>
  
  <p>I have also defined some pseudo-global constants which are located in a fixed place on the "Main" sheet in a similar way, for example:</p>
  
  <pre><code>    Function NumLines() As Integer
          NumLines = MAIN.Range("C3").Value
      End Function
  </code></pre>
  
  <p>In this way, I use "NumLines" just like any variable throughout the code.
  I expect that there is a more efficient way to manage globally accessed variables like these and was wondering, what would be a better way to accomplish this?</p>