I wanted to create the following toggle button.
Button would say 'Hide Done' and when clicked, it would hide all rows with the letter 'a' in cell in column B.
Same button would now say 'Show Done', and when clicked again, it would show the rows again.

Here's the code I came up with, but it's not working.

Private Sub ShowHideDoneClickButton()
ActiveSheet.Unprotect
Dim Cap1 As String, Cap2 As String
Cap1 = "Hide Done"
Cap2 = "Show Done"
Dim cell As Range
    For Each cell In Range("$B:$B")
        If cell.Value = "a" Then
            cell.EntireRow.Hidden = True
    CommandButton1.Caption = Cap1
Else
Application.ScreenUpdating = False

Dim cell As Range
    For Each cell In Range("$B:$B")
        If cell.Value = "a" Then
            cell.EntireRow.Hidden = False
    CommandButton1.Caption = Cap2
End If
ActiveSheet.Protect
End Sub
What am I doing wrong or missing?
This has been driving me crazy for the past couple weeks, and have looked everywhere for an answer.

Thanks.