Results 1 to 6 of 6

Thread: Filter data - date range and customer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Jan 2021
    Posts
    16
    Location

    Cool Filter data - date range and customer

    Screen Shot 2021-01-27 at 20.50.30.jpg

    Hello


    According to the example above it should show records starting with ( like% ) the letters "tip" in the the specified "date range".

    Please tell me what's wrong in the code below:

    =====

    Option Explicit


    Sub data_controle()

    Dim lngStart As Long, lngEnd As Long

    Dim Repres As String

    lngStart = Range("b4").Value

    lngEnd = Range("c4").Value

    Range("c12:m2000").AutoFilter Field:=1, _
    Criteria1:=">=" & lngStart, _
    Operator:=xlAnd, _
    Criteria2:="<=" & lngEnd

    Range("C13", Range("C13").End(xlDown)).Sort Key1:=Range("C13"), Order1:=xlAscending, Header:=xlNo

    ActiveSheet.Range("$C$12:$M$2109").AutoFilter Field:=1, Criteria1:=">=" & lngStart, Operator:=xlAnd, Criteria2:="<=" & lngEnd

    ' the line below is not working ... ? - Repres

    ' ActiveSheet.Range("d4").AutoFilter Field:=2, Criteria1:=Repres & "*"



    End Sub

    =====

    Thank you
    Attached Images Attached Images
    Last edited by JonasB; 01-27-2021 at 04:53 PM.

Tags for this Thread

Posting Permissions

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