Results 1 to 23 of 23

filter by today's date

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    filter by today's date

    Hi I need to filter a worksheet if the date dd/mm/yy in column 5 is =today()-182
    Until now I've been ok filtering by strings etc but...

    Private Sub CB_Think25_Click()
     Application.ScreenUpdating = False    ' turns off screen refreshing.
    
        Dim LRow2            As String
        Dept = "Bakery"
        'sets the variables wsM equal to Main worksheet and wsM2 equal to Main2
        Set wsM = Sheets("Main")
    Set wsM2 = Sheets("Main2")
        LRow2 = 0
        'reset main
            Sheets("main").Select
    If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
        'select the Main2 worksheet
        With wsM2
        wsM2.UsedRange.Clear
            'select all the cells
    'THIS NEXT LINE
            wsM.UsedRange.AutoFilter Field:=3, Criteria1:=Dept
            wsM.Columns("b:b").Copy .Range("a1")
            wsM.Columns("d:d").Copy .Range("b1")
            wsM.Columns("f:f").Copy .Range("c1")
            wsM.Columns("q:q").Copy .Range("e1")
            wsM.Columns("r:r").Copy .Range("g1")
            wsM.Columns("g:g").Copy .Range("h1")
    Last edited by KAPearson; 05-25-2012 at 02:26 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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