Solved

Excel VBA Checkbox action

Posted on 2015-01-27
5
62 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 31

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

744 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

16 Experts available now in Live!

Get 1:1 Help Now