+ Reply to Thread
Results 1 to 5 of 5

Use Checkboxes to Filter a List

  1. #1
    Registered User
    Join Date
    04-30-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Use Checkboxes to Filter a List

    I am working on a tool and need to accomplish several things using the checkbox form control. I have a questionnare that needs to be filtered by functional role so that the appropriate person can complete the appropriate questions and not have to view the entire list.

    I have assigned roles to each question by entering IT, HR, FM, or PS in the next column. I can use autofilter to show just the questions for each role or multiple roles but I want the form to be easy for the user so checkboxes would be a better solution. The checkboxes should allow the user to select one or multiple roles. Additionally, the user should be able to uncheck a role checkbox to hide the associated questions if he/she makes an error in selecting his/her role.

    Please help. I have very little knowledge of VBA script.

  2. #2
    Registered User
    Join Date
    04-30-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Use Checkboxes to Filter a List

    Here is a simple version of my questionnare.
    Sample for forum.xlsm

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Use Checkboxes to Filter a List

    Hi corrinrenee

    Welcome to the Forum!

    First rename your CheckBoxes to IT, HR, PS, etc. Then assign this code to each CheckBox...let me know of issues.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    04-30-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Use Checkboxes to Filter a List

    Thank you for the code! I was however, I was able to get the following code to work when I assigned the checkboxes to column CK for "true" and "false" value to populate.

    Sub IT_Click()
    Dim searchcriteria As String
    Dim i As Integer
    ' reading what has been clicked, line below reads the value from row 1 and column 91
    If Worksheets("Input- Questions").Cells(1, 91).Value = True Then
    'If ActiveSheet.Shapes("IT").Value = xlOn Then
    For i = 12 To 178
    If Range("CK" & i).Value = "IT" Then
    ActiveSheet.Rows(i).Hidden = False

    End If
    Next
    End If
    If Worksheets("Input- Questions").Cells(1, 91).Value = False Then
    'If ActiveSheet.Shapes("IT").Value = xlOn Then
    For i = 12 To 178
    If Range("CK" & i).Value = "IT" Then
    ActiveSheet.Rows(i).Hidden = True

    End If
    Next
    End If
    End Sub

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Use Checkboxes to Filter a List

    Hi corrinrenee

    Please use Code Tags around you Code.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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