title: OptionButton determines value then use in macro
body: <p>A basic simple VBA question that I havent been able to work out even though there are numerous tutorials about it.</p>
  
  <p>I want a Userform to pop-up, give you two options (OptionButton1 and OptionButton2). You choose one, click ok. And depending on what Option is chosen a certain value is used (in an email, for which I DID finish the macro). For simplifying purposes i now just want the variable 'contents' to be printed in cell A1.</p>
  
  <p>I have these parts so far:</p>
  
  <pre><code>Sub MailOption()
  UserForm1.Show
  End Sub
  
  Private Sub OptionButton1_Click()
  If OptionButton1.Value = True Then Var1 = "Text example 1"
  End Sub
  
  Private Sub OptionButton2_Click()
  If OptionButton2.Value = True Then Var1 = "Text example 2"
  End Sub
  
  Private Sub SendEmail_Click()
  Cells(1, 1).Value = Var1
  End Sub
  </code></pre>
  
  <p>There are multiple problems: the variable is not shown in Cell A1 and when i press Send Email the Form is not closed. I am probably doing lots of stuff wrong but its the first time im using a userform. Ty very much</p>