[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 127
  • Last Modified:

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.
0
macone1976
Asked:
macone1976
  • 2
  • 2
1 Solution
 
Wayne Taylor (webtubbs)AstronautCommented:
What sort of Checkbox are you using? Forms or ActiveX?
0
 
macone1976Author Commented:
Forms
0
 
Wayne Taylor (webtubbs)AstronautCommented:
Assign this Macro to the Checkbox....

Sub CheckBox1_Click()
    
    Range("A34:H54").EntireRow.Hidden = (ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = 1)
    
End Sub

Open in new window


...where "Check Box 1" is the name of your Checkbox. Note that you can't hide individual cells, only entire rows or columns. If you wanted to hide columns A:H, change EntireRow to EntireColumn.
0
 
macone1976Author Commented:
Thanks, it works...
0
 
Rossano PraderiIT ConsultantCommented:
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

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now