title: How to declare Global Variables in Excel VBA to be visible across the Workbook
body: <p>I have a question about global scope and have abstracted the problem into a simple example:</p>
  
  <p>In an Excel Workbook:
  In <strong>Sheet1</strong> I have two(2) buttons.<bR>
  The first is labeled <strong>SetMe</strong> and is linked to a subroutine in <strong>Sheet1's module</strong>:<br>
  <strong>Sheet1 code:</strong></p>
  
  <pre><code>Option Explicit
  Sub setMe()
      Global1 = "Hello"
  End Sub
  </code></pre>
  
  <p>The second is labeled <strong>ShowMe</strong> and is linked to a subroutine in <strong>ThisWorkbook's module</strong>:<bR>
  <strong>ThisWorkbook code:</strong></p>
  
  <pre><code>Option Explicit
  Public Global1 As String
  Debug.Print("Hello")
  Sub showMe()
      Debug.Print (Global1)
  End Sub
  </code></pre>
  
  <p>Clicking on <strong>SetMe</strong> produces a compiler <code>error: variable not defined</code>.<br>
  When I create a separate module and move the declaration of <strong>Global1</strong> into it everything works.</p>
  
  <p><strong>So my question is:</strong>
  Everything I have read says that Global variables, declared at the top of a module, outside of any code should be visible to all modules in the project.  Clearly this is not the case.
  Unless my understanding of <strong>Module</strong> is not correct.<br>
  The objects <code>Sheet1</code>, <code>Sheet2</code>, <code>ThisWorkbook</code>,... that come with a workbook: are these not modules capable of declaring variables at global scope?</p>
  
  <p>Or is the only place one can declare a global, in a separate module of type <strong>Modules</strong>.</p>