title: Excel VBA - Public variable not passing between modules
body: <p>I am trying to pass a publicly declared variable's value from a userform back to a module where the code initially started.  I can print the value of the variable in the userform, but it does not persist when the code jumps back to the starting module.
  Option Explicit is declared on both sides, and I declared the single variable as well (ignore the var2 - var6 as they are not in use until I fix this singular issue).</p>
  
  <p>The code path starts in the first section below, jumps to the userform at "StatSelection.Show" and then jumps back at the end of the userform sub.  The first debug.print provides the variable, but the second one is blank..</p>
  
  <p>The main code is:</p>
  
  <pre><code>Option Explicit
  
  Public var1 As String
  
  Sub NoNameGame2FirstRoundResults()
  '
  ' NoNameGame Macro
  '
  '
  'Load Round 1 file
      Dim r1Name As Variant
      Dim nngr1r As Workbook
      ChDir "D:\Users\stefan.bagnato\Desktop\No Name Game"
      r1Name = Application.GetOpenFilename
      If r1Name &lt;&gt; False Then
          Set nngr1r = Workbooks.Open(r1Name)
      End If
  
  'Load previous week's file
      Dim r1rName As Variant
      Dim wps As Workbook
      ChDir "D:\Users\stefan.bagnato\Desktop\Weekly Performance Summary"
      r1rName = Application.GetOpenFilename
      If r1rName &lt;&gt; False Then
          Set wps = Workbooks.Open(r1rName)
      End If
  
  'Create radio buttons to select week 1 stat
      StatSelection.Show
  
  'Parse Column B for names, and paste corresponding data in column C
  nngr1r.Activate
  
  Debug.Print var1
  
  ActiveWorkbook.Worksheets("Sheet1").Columns(2).Find("Adam").Offset(N, 1) = var1
  
  End Sub
  </code></pre>
  
  <p>The userform is:</p>
  
  <pre><code>    Option Explicit
  
  Public var1 As String
  
  Sub OptionButton1_Click()
      Dim wps As Workbook, x As String
      For Each wps In Workbooks
      If wps.name &lt;&gt; ThisWorkbook.name Then x = wps.name
      Next wps
      Workbooks(x).Activate
  
      var1 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F4")), "hh:mm:ss")
      var2 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F5")), "hh:mm:ss")
      var3 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F6")), "hh:mm:ss")
      var4 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F7")), "hh:mm:ss")
      var5 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F9")), "hh:mm:ss")
      var6 = Format((ActiveWorkbook.Worksheets("Sheet1").Range("F10")), "hh:mm:ss")
  
  
      Debug.Print var1
  
      Me.Hide
  End Sub
  </code></pre>