Results 1 to 4 of 4

Thread: VBA Autofilter partial match in column
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Mar 2016
    Location
    Surrey
    Posts
    155
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA Autofilter partial match in column

    Hi

    I currently have;
    Code:
    Sub Button1_Click()
        With ActiveSheet.Range("A8:J61")
            .AutoFilter Field:=2, Criteria1:=ActiveSheet.Range("A5").Value
            .AutoFilter Field:=4, Criteria1:=ActiveSheet.Range("B5").Value
            .AutoFilter Field:=9, Criteria1:=ActiveSheet.Range("C5").Value
    End With
    End Sub
    But what I'm trying to do is something like;
    Code:
    Sub Button1_Click()
        With ActiveSheet.Range("A8:J61")
            .AutoFilter Field:=2, Criteria1:=ActiveSheet.Range("A5").Value
            .AutoFilter Field:=4, Criteria1:=Text that partially matces ActiveSheet.Range("B5").Value
            .AutoFilter Field:=9, Criteria1:=ActiveSheet.Range("C5").Value
    End With
    End Sub
    Any help would be hugely appreciated!

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,079
    Post Thanks / Like
    Mentioned
    390 Post(s)
    Tagged
    41 Thread(s)

    Default Re: VBA Autofilter partial match in column

    Try
    Code:
    .AutoFilter Field:=4, Criteria1:="*" & ActiveSheet.Range("B5").Value & "*"
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

  3. #3
    Board Regular
    Join Date
    Mar 2016
    Location
    Surrey
    Posts
    155
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA Autofilter partial match in column

    That's perfect, thank you Fluff!

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,079
    Post Thanks / Like
    Mentioned
    390 Post(s)
    Tagged
    41 Thread(s)

    Default Re: VBA Autofilter partial match in column

    Glad to help & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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