Solved

Hide cells

Posted on 2014-12-23
5
116 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 500 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

626 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