+ Reply to Thread
Results 1 to 3 of 3

Filtering with multiple criteria in certain column

  1. #1
    Registered User
    Join Date
    12-29-2008
    Location
    Duri, Sumatra
    MS-Off Ver
    Excel 2003
    Posts
    2

    Filtering with multiple criteria in certain column

    Hi All,

    I need to filter the data in Column B, starting from row 14, with 3 criteria. I have the code to filter that can do only in 2 criteria, would you please help me to modify the code as below :

    Private Sub CommandButton1_Click()
    Dim kriteria1 As String
    Dim kriteria2 As String
    kriteria1 = "*" & Me.TextBox1.Value & "*"
    kriteria2 = "*" & Me.TextBox2.Value & "*"

    Me.TextBox1.SetFocus
    'check for a value & show message
    If kriteria1 = "" Then 'the textbox in userform
    Me.TextBox1.SetFocus
    MsgBox "Please enter a value to find." ' show message if no value entered
    Exit Sub
    Else
    Sheets("SUMMARY").Select
    Range("A13:EK13").Select
    Selection.AutoFilter
    Selection.AutoFilter Field:=2, Criteria1:=kriteria1, Operator:=xlAnd, _
    Criteria2:=kriteria2

    Beep
    End If
    End Sub


    Thank in advance

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Hi and welcome to our forum,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    12-29-2008
    Location
    Duri, Sumatra
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Filtering data with 3 criteria

    Dear NBVC,

    Thank for the correction.

    Hi All,

    I need to filter the data in Column B, starting from row 14, with 3 criteria. I have the code to filter that can do only in 2 criteria, would you please help me to modify the code as below :

    Please Login or Register  to view this content.

+ 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