Solved

Excel VBA Checkbox action

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
EXCEL file checking. 11 47
need copy macro to select range to copy 23 47
move line without macro or copy/paste 6 38
Combine Vlookup with indirect sheet reference 3 18
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

739 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