+ Reply to Thread
Results 1 to 3 of 3

Hide/Unhide Rows based on column data using checkbox

Hybrid View

  1. #1
    Registered User
    Join Date
    08-14-2015
    Location
    Janesville, WI
    MS-Off Ver
    2010
    Posts
    1

    Post Hide/Unhide Rows based on column data using checkbox

    I have a questionnaire that I am developing that will require additional questions based on the group. There are standard questions that are visible when questionnaire is opened. I want to use check box to add additional questions for that that group (Group A). I want to use a check box for to add questions and hide some of the standard questions for that group (Group B).

    I have read some of the threads and did not see a solution to my specific need.

    I need to insure that macros hide or unhide the right rows when I need to add additional question rows.

    Attached file is a test example. The actual questionnaire will have over 200 lines and over 20 possible groups or scenarios.

    Thank you for any assistance that can be provided.

    Rick
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Hide/Unhide Rows based on column data using checkbox

    It may be easiest to have an unique identify of the rows you want to hide and unhide for Group B, and so on.

    But this is some code that will just look at "Question" and Toggle the Row Hidden attribute between True and False. It should help you get started and is set for the fixed range of questions. But that can be modified to look down the sheet to the last row/question as needed.

    Sub UnHideGroupA()
        Dim MyQuestions As Range, MyCell As Range
        
        Set MyQuestions = Range("B5:B24")
    
        For Each MyCell In MyQuestions
            If MyCell = "Group A ?" And MyCell.EntireRow.Hidden = False Then
                MyCell.EntireRow.Hidden = True
            ElseIf MyCell = "Group A ?" And MyCell.EntireRow.Hidden = True Then
                MyCell.EntireRow.Hidden = False
            End If
        Next MyCell
        
    End Sub
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Hide/Unhide Rows based on column data using checkbox

    or like sheet2


    Kind regards
    Leo
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Userform/checkbox hide/unhide rows based on cell value
    By MOHAMMESALMAN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2015, 03:17 AM
  2. [SOLVED] User form/checkbox hide/unhide rows based on cell value
    By ldonis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2014, 11:35 AM
  3. Hide Unhide Rows using Checkbox
    By Huskersippi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2014, 05:08 PM
  4. [SOLVED] Macro to Automatically Hide/Unhide Rows Based on Checkbox
    By bga10s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2014, 07:32 PM
  5. [SOLVED] Checkbox VBA - Hide/Unhide Rows and/or Columns based on cell values
    By gravy258 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-21-2013, 05:39 PM
  6. hide/unhide rows using checkbox
    By elfirahayu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2010, 03:31 PM
  7. Hide / unhide rows with help of a checkbox
    By Hansa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-03-2009, 12:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1