title: User form can't pass value to module
body: <p>I've inserted a user form into a project that already contains a bunch of modules. By playing around with the code in the user form, I've verified that I can return the value from a combo box.</p>
  
  <p>User form code:</p>
  
  <pre><code>Public SelectedPacking As Integer
  
  Private Sub CancelButton_Click()
      UserForm1.Hide        
   End Sub
  
  Private Sub OKButton_Click()
      SelectedPacking = ComboBox1.ListIndex    
      Call DemoDialogOk
  
      'Return list index value to cell C50
      Worksheets("Inputs &amp; Results").Range("C50") = SelectedPacking    
      Unload UserForm1    
  End Sub
  </code></pre>
  
  <p>My problem is that I can't pass this value on to any of the macros written in the modules.</p>
  
  <p>Module code:</p>
  
  <pre><code>Public Sub ShowComboBox()
      UserForm1.Show    
  End Sub
  
   Public Sub DemoDialogOk()    
      ival = SelectedPacking
  
      'Return value of ival (list index value from combo box) to cell C17
       Worksheets("Packed bed (Random)").Range("C17") = ival
  End Sub
  </code></pre>
  
  <p>Obviously the module contains more useful code, but I've commented out everything to try and figure out where I'm going wrong. I've been changing some things around, but I still can't get anything to appear in cell C17, so I think I'm missing something fundamental. </p>