Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2015
    Posts
    148
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Using Check Box to show only rows of data that contain a specific word

    Hi Experts,

    I am learning to use check boxes to filter data by rows if a specific word is present.

    I'm a long way from finding what I need at the moment. I've been working with google for hours and this is the best code I've found so far.

    If Me.CheckBox1.Value = True Then UserForm1.TextBox1.Value = Worksheets("sheet1").Range("c3")

    This code is a long ways from what I need, at least it is a start.

    Please see the attached file.

    I would like to show all the rows of data if History appears in column C in the text box of the form. Thanks
    Attached Files Attached Files

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,629
    Thanks
    114
    Thanked 645 Times in 589 Posts
    Excel,

    Here is some code I wrote some time age that filters rows by col G as you type and highlights the search criteria. I am sure you can adapt it to fit your needs

    HTH,
    Maud

    No search criteria entered:
    excel2.png

    Filter as you type:
    Excel3.png
    Attached Files Attached Files

  3. The Following User Says Thank You to Maudibe For This Useful Post:

    Excelnewbie (2015-11-24)

  4. #3
    2 Star Lounger
    Join Date
    Apr 2015
    Posts
    148
    Thanks
    67
    Thanked 0 Times in 0 Posts
    Maud,

    Thanks to you, I was able to get my check box working as I'd hope. The code you provided gave me what I needed.

    I have two questions unrelated to the check box.

    1. I noted on the form you provided that the auto-filter drop downs didn't show. How was that done? I had to use this code to hide the auto-filter drop downs in my file:

    Sub HideAutoFilterDropdowns()

    With Range("A1:C1")
    .AutoFilter Field:=1, VisibleDropDown:=False
    .AutoFilter Field:=2, VisibleDropDown:=False
    .AutoFilter Field:=3, VisibleDropDown:=False


    End With
    End Sub

    2. How would you define the variable "I" in your code.

    Thanks for everything!
    Last edited by Excelnewbie; 2015-11-24 at 17:49.

  5. #4
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,629
    Thanks
    114
    Thanked 645 Times in 589 Posts
    Excel,

    The header is actually a textbox that covers the entire first row. Since "I" can receive a value from the variable "LastRow" (I= 2 to LastRow) and since "LastRow" is defined as an Integer, then I would define "I" as an integer also. Got burnt on that one time defining my row counter as an integer, which I received an "I told you so" from zeddy, when the number of rows were about 50K. As you know, an integer is limited to 32,767 so now I define my row counters as Long. A lesson well learned.

    Maud

Posting Permissions

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