Consulting

Results 1 to 6 of 6

Thread: AutoFilter Previous Months Data

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    AutoFilter Previous Months Data

    I want to be able on a daily basis to filter out and delete data from the previous month.

    So when January comes round for example it uses January 2016 as the current month and deletes everthing prior to that date.

    I attach a sample spreadsheet and some code I've tried which literally filters out everything. The spreadsheet has a named range in cell "D1" called "Month".

    [CODE]Sub Macro1()
    '
    ' Macro1 Macro
    '
    '
    Dim Month As Range
    Range("D1").Select
    Set Month = Range("D1").CurrentRegion
    ActiveSheet.Range("$A$1:$B$2").AutoFilter Field:=2, Criteria1:= _
    "<""Month"", Operator:=xlAnd"
    End Sub[CODE]
    Attached Files Attached Files

Posting Permissions

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