Solved

Excel VBA Checkbox action

Posted on 2015-01-27
5
65 Views
Last Modified: 2015-02-19
I have a checkbox that when checked I need cells A10:H13 to be visible, and when the checkbox is not checked I need A10:H13 to be hidden.
0
Comment
Question by:macone1976
5 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 40573489
By hidden do you mean

entire rows hidden
entire columns hidden
entire rows and columns hidden
or just the text hidden with the cells visible?
0
 

Author Comment

by:macone1976
ID: 40573507
entrie rows hidden
0
 

Expert Comment

by:EISTO
ID: 40573518
3 specific rows, or will the row numbers change depending on the content in the spreadsheet?
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 40573543
You can use this macro as shown in the attached file

Private Sub CheckBox1_Change()
    If CheckBox1 Then
        Range("A10:H13").EntireRow.Hidden = True
    Else
        Range("A10:H13").EntireRow.Hidden = False
    End If
End Sub
Hiddenrowswithcheckbox.xls
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40575062
Does it have to a check box? You can do this without VBA.

Select the three rows and go to the Data Menu and choose Group > Rows.

This will put a button in the left hand margin, next to either row 9 or 14 depending on settings, and will enable the hiding or unhiding of those rows. When hidden the button will show a + sign, when unhidden the button will show a - sign and the rows affected will have a little bullet next to them.

Thanks
Rob H
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to read BOM (Byte Order Mark) from csv file. 4 37
consolidate from multiple folders 5 39
Moving Excel to AaaS 4 37
Excel Save As Status Box will not go away 6 19
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

920 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

15 Experts available now in Live!

Get 1:1 Help Now