+ Reply to Thread
Results 1 to 4 of 4

Filter based 3 criteria

Hybrid View

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Filter based 3 criteria

    Hi all

    I need filter based 3 criteria, but my filter it's diplay wron result.


    Thanks
    Attached Files Attached Files
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Filter based 3 criteria

    marreco,
    You have used "PEQUENO" twice. Is this correct?

    Option Explicit
    
    Sub Filtered_Icorrect()
    Dim lRow As Long
    
    Worksheets("FRM").Range("A2:AB10000").ClearContents
        Application.ScreenUpdating = False
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="PEQUENO"
            .Range("A2:B" & lRow).COPY Worksheets("FRM").Range("A" & Rows.Count).End(xlUp).Offset(1)
            .Range("G2:G" & lRow).COPY Worksheets("FRM").Range("G" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="MEDIO"
            .Range("A2:G" & lRow).COPY Worksheets("FRM").Range("I" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="GRANDE"
            .Range("A2:G" & lRow).COPY Worksheets("FRM").Range("Q" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        
        Application.CutCopyMode = False
        Application.ScreenUpdating = True
    End Sub
    Last edited by AB33; 02-23-2014 at 11:18 AM.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Filter based 3 criteria

    Based on your result.

    Sub Filtered_Icorrect1()
    Dim lRow As Long
    
    Worksheets("FRM").Range("A2:AB10000").ClearContents
        Application.ScreenUpdating = False
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="PEQUENO"
            .Range("A2:B" & lRow).COPY Worksheets("FRM").Range("A" & Rows.Count).End(xlUp).Offset(1)
            .Range("G2:G" & lRow).COPY Worksheets("FRM").Range("G" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="MEDIO"
            .Range("A2:G" & lRow).COPY Worksheets("FRM").Range("I" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        With Sheet1
            .AutoFilterMode = False
            lRow = .Range("A" & Rows.Count).End(xlUp).Row
            .Range("A1:G" & lRow).AutoFilter Field:=1, Criteria1:="PEQUENO"
            .Range("A2:G" & lRow).COPY Worksheets("FRM").Range("Q" & Rows.Count).End(xlUp).Offset(1)
            .Range("A1").AutoFilter
        End With
        
        Application.CutCopyMode = False
        Application.ScreenUpdating = True
    End Sub

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Filter based 3 criteria

    Hi AB33, i like it, i'm very glad, thank you very much!!!

+ 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. filter based on 2 criteria
    By simran555 in forum Excel General
    Replies: 6
    Last Post: 10-30-2013, 02:16 AM
  2. Filter List Based On Certain Criteria
    By Scott_88 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-17-2012, 08:49 AM
  3. Filter based on User Criteria
    By Lvenom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2012, 05:20 PM
  4. Macro to Filter Based on Criteria in Another Tab
    By nwd9s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2011, 12:33 PM
  5. [SOLVED] Pop Up box to filter based on User Criteria
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2006, 08:50 AM

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