Consulting

Results 1 to 3 of 3

Thread: Autofilter with VBA

  1. #1

    Autofilter with VBA

    Dear all,

    I've started with VBA a couple of month ago and i'm getting some difficulties creating a code to filter a data base using another cell as a "contain" criteria.
    I don't have problems if i use the cell as criteria:

    [vba]
    ActiveSheet.Range("$A$6:$AY$5008").AutoFilter Field:=1, Criteria1:=Range("informe_iso!A1")
    [/vba]

    but if i try to used a cell to filter as "contain" criteria it it will give me a compile error:

    [vba]
    ActiveSheet.Range("$A$6:$AY$5008").AutoFilter Field:=1, Criteria1:=*Range("informe_iso!A1")*
    [/vba]

    ths for your help

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Have you tried

    [vba]

    ActiveSheet.Range("$A$6:$AY$5008").AutoFilter Field:=1, Criteria1:="*" & Range("informe_iso!A1").Value & "*"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Tks, it's working

Posting Permissions

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