Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hide cells

Posted on 2014-12-23
5
Medium Priority
?
119 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 47

Expert Comment

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

Author Comment

by:macone1976
ID: 40515621
Forms
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 40515642
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
ID: 40515755
Thanks, it works...
0
 
LVL 2

Expert Comment

by:Rossano Praderi
ID: 40515772
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

670 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