Filter choice selection based on combobox values not working

  • Hi guys, based on Kenneth Hobson on my previous problem really help me alot. But my codes have a little problem on filtering the data. When i try to find "Test" without select the comboBox, the result will filter well. But the problem is now, when i want to find "Test" but with category in the combo box the result only shows 2 data while it suppose to get 6 data with the word "Test" in "E-Professional" category.
    [ATTACH=CONFIG]73879[/ATTACH][ATTACH=CONFIG]73880[/ATTACH]


    Here is the codes for the selection based on category


  • Re: Filter choice selection based on combobox values not working


    I would have to look into it more if you want to stick with the Find method. You can probably simplify your other routines similar to that below.


    It seems like you want a multiple field Autofilter with a Contains method for Field 1. e.g.

    Code
    Private Sub cbo_cat_Change()
      Dim r As Range
      Set r = Intersect(ActiveSheet.UsedRange, Range("A3:E" & Cells(Rows.Count, "A").End(xlUp).Row))
      ActiveSheet.AutoFilterMode = False
      With r
        If pos_txt <> "" Then .AutoFilter 1, "=*" & pos_txt & "*" 'Contains pos_txt
        If anz_txt <> "" Then .AutoFilter 3, anz_txt
        .AutoFilter 5, cbo_cat
      End With
    End Sub
  • Re: Filter choice selection based on combobox values not working


    You r super :drum: . Thank you

    Quote from nyatiaju;800098

    There were Few corrections done in the POS_Click code. Please Try attached:

  • Re: Filter choice selection based on combobox values not working


    Quote from nyatiaju;800098

    There were Few corrections done in the POS_Click code. Please Try attached:


    can i ask you, what did you do? as my POS_click code is perfect but my ANZ_click code is going crazy like the previous POS_click :ufo:

  • Re: Filter choice selection based on combobox values not working


    Quote from Kenneth Hobson;800106

    I would have to look into it more if you want to stick with the Find method. You can probably simplify your other routines similar to that below.


    It seems like you want a multiple field Autofilter with a Contains method for Field 1. e.g.

    Code
    Private Sub cbo_cat_Change()
      Dim r As Range
      Set r = Intersect(ActiveSheet.UsedRange, Range("A3:E" & Cells(Rows.Count, "A").End(xlUp).Row))
      ActiveSheet.AutoFilterMode = False
      With r
        If pos_txt <> "" Then .AutoFilter 1, "=*" & pos_txt & "*" 'Contains pos_txt
        If anz_txt <> "" Then .AutoFilter 3, anz_txt
        .AutoFilter 5, cbo_cat
      End With
    End Sub


    You r rocking sir

  • Re: Filter choice selection based on combobox values not working


    can i ask you, what did you do? as my POS_click code is perfect but my ANZ_click code is going crazy like the previous POS_click :yikes:

    Quote from nyatiaju;800315

    No problem. :cheers:

  • Re: Filter choice selection based on combobox values not working


    Do you want to filter :[TABLE="width: 250"]

    [tr]


    [td]

    ANZSCO TITLE & Category.
    If yes, I will have to look that code as well.

    [/td]


    [/tr]


    [/TABLE]

  • Re: Filter choice selection based on combobox values not working


    Yes. it has the same problem with POS title before :oops:

  • Re: Filter choice selection based on combobox values not working


    Please paste following for ANZ:


  • Re: Filter choice selection based on combobox values not working


    it work!!! but when i only search without select the category it error


    Code
    object variable or with block variable not set


    Quote from nyatiaju;800326

    Please paste following for ANZ:


  • Re: Filter choice selection based on combobox values not working


    Salamat Sir!!. You rock!! :pirate:

    Quote from nyatiaju;800328

    See attached :

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!