?
Solved

Excel VBA Checkbox action

Posted on 2015-01-27
5
Medium Priority
?
81 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
[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
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 2000 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 33

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

743 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