Link to home
Start Free TrialLog in
Avatar of macone1976
macone1976Flag for United States of America

asked on

Hide cells

I have a checkbox on an excel sheet.  when checked, I need to hide cells A34:H54, when unchecked make the cells visible.
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

What sort of Checkbox are you using? Forms or ActiveX?
Avatar of macone1976

ASKER

Forms
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, it works...
Avatar of Member_2_6404472
Member_2_6404472

The follow code can be an alternative solution...

Private Sub CheckBox1_Click()
  If CheckBox1.Value Then
    Hide
  Else
    UnHide
  End If
End Sub
Sub Hide()
    With Range("A34:H54").Font
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
    End With
End Sub
Sub UnHide()
    With Range("A34:H54").Font
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
    End With
End Sub

Open in new window