title: Make Excel visible when closing userform
body: <p>I have a button in an Excel worksheet that opens a userform when clicked. It also hides the worksheet, making it so you can only see the userform. Here's what I have to make that happen. This works fine.</p>
  
  <pre><code>Sub Button2_Click()
      Application.Visible = False
      frmDataColl.Show
  End Sub
  </code></pre>
  
  <p>Then I have this code that isn't working the way I want it to. Upon clicking the X to close the userform, I want the userform to close and also make Excel visible again. But this only closes the userform. It doesn't bring the workbook back into view.</p>
  
  <pre><code>Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
      If CloseMode = vbFormControlMenu Then
      Application.Visible = True
      End If
  End Sub
  </code></pre>