Solved

Hide cells

Posted on 2014-12-23
5
100 Views
Last Modified: 2014-12-23
I have a checkbox on an excel sheet.  when checked, I need to hide cells A34:H54, when unchecked make the cells visible.
0
Comment
Question by:macone1976
  • 2
  • 2
5 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
Comment Utility
What sort of Checkbox are you using? Forms or ActiveX?
0
 

Author Comment

by:macone1976
Comment Utility
Forms
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:macone1976
Comment Utility
Thanks, it works...
0
 
LVL 2

Expert Comment

by:Rossano Praderi
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now