title: How to use VBA to read the values of a checkbox from an Excel userform
body: <p>I have created a userform that contains two checkboxes.  I would like to be able to do different things depending on whether each box is checked or unchecked.  However, it seems like no matter what I do, it will always tell me the original value of the checkboxes (false and false).  Here is the code attached to clicking CommandButton1:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  ReadData
  
  End Sub
  </code></pre>
  
  <p>And here ReadData:</p>
  
  <pre><code>Sub ReadData()
  
  Dim myForm As UserForm
  Set myForm = UserForms.Add("ComplaintEntryForm")
  
  Debug.Print (myForm!CheckBox1.Name)
  Debug.Print (myForm!CheckBox1.Value)
  Debug.Print (myForm!CheckBox2.Name)
  Debug.Print (myForm!CheckBox2.Value)
  
  End Sub
  </code></pre>
  
  <p>No matter how the boxes are checked, the immediate window always shows this:</p>
  
  <pre><code>VBA.UserForms.Add("ComplaintEntryForm").Show
  CheckBox1
  False
  CheckBox2
  False
  </code></pre>
  
  <p>I have a screenshot of the whole operation but it won't let me upload it because I'm a new user.</p>