rob
rob

Reputation: 317

Checkbox to Hide/Unhide Row Not Unhiding

I have a form control checkbox and the following code to hide and unhide row 10.
It hides but does not unhide.

Sub CheckBox1_Click()

    If Range("C84").Value = True Then
        Rows("10:10").EntireRow.Hidden = False
    Else
        Rows("10:10").EntireRow.Hidden = True
    End If

End Sub

Upvotes: 0

Views: 307

Answers (2)

meetrk85
meetrk85

Reputation: 53

For it to unhide c84 value should be false as long as it is true it will be hidden only

Upvotes: 1

Zer0Kelvin
Zer0Kelvin

Reputation: 354

The code works perfectly. Furthermore, if the value of cell C84 is not used elsewhere, the same can be obtained without using LinkedCell:

Sub CheckBox1_Click()

    Rows("10:10").EntireRow.Hidden = Not CheckBox1

End Sub

Upvotes: 3

Related Questions