title: Hide two sets of rows separately
body: <p>I have Excel VBA with 2 buttons. When one is clicked certain rows are hidden and when the other one is clicked another selection of rows are hidden.</p>
  
  <p>When I try to hide both sections of rows it gives me a run-time error 1004</p>
  
  <pre><code>Private Sub CommandButton1_Click()
      With Rows("7:14")
          .Select
          .EntireRow.Hidden = Not .EntireRow.Hidden
      End With
  End Sub
  
  Private Sub CommandButton2_Click()
      With Rows("16:24")
         .Select
         .EntireRow.Hidden = Not .EntireRow.Hidden
      End With
  End Sub
  </code></pre>