Hello,

I would like to use a toggle button to either show all empty cells in a range, or show all cells with values in the same range.

Right now my code works well for hiding all empty cells, but I can't find a good way to make the "untoggle" part of the button make all the filled cells be removed. Any thoughts?

Current Code:

Private Sub ToggleButton1_Click()
Dim X As Integer
Dim Y As Integer
If ToggleButton1.Value = True Then
On Error Resume Next
For Each Cell In Range("C9:C48")
    If Cell <> "" Then
        Cell.EntireRow.Hidden = False
    Else
        Cell.EntireRow.Hidden = True
        X = X + 1
        End If
Next
Else
    Range("C9:C48").EntireRow.Hidden = False
End If
End Sub