1

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.

When I try to hide both sections of rows it gives me a run-time error 1004

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
Community
  • 1
  • 1

0 Answers0