+ Reply to Thread
Results 1 to 2 of 2

Auto Filter Delete Rows by Criteria Doesn't Work Range To Complicated

  1. #1
    Registered User
    Join Date
    04-04-2005
    Location
    Bahama, NC
    Posts
    59

    Auto Filter Delete Rows by Criteria Doesn't Work Range To Complicated

    That is what I got, I always use the auto filter method to delete rows, but this time I have a sheet that is 41000 rows long and I guess since there are so many rows to be deleted it decided it was to hard. So what it will do is just delete everything in the filter. Strange i haven't had that happen before. So does anyone have or know of an alternative way to delete rows by criteria, that would be of mass fashion not line by line, I have tried a few of those and it would take all day long to do that.
    Thanks for the help,
    Bob

  2. #2
    Jef Gorbach
    Guest

    Re: Auto Filter Delete Rows by Criteria Doesn't Work Range To Complicated


    "robertjtucker" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > That is what I got, I always use the auto filter method to delete rows,
    > but this time I have a sheet that is 41000 rows long and I guess since
    > there are so many rows to be deleted it decided it was to hard. So what
    > it will do is just delete everything in the filter. Strange i haven't
    > had that happen before. So does anyone have or know of an alternative
    > way to delete rows by criteria, that would be of mass fashion not line
    > by line, I have tried a few of those and it would take all day long to
    > do that.
    > Thanks for the help,
    > Bob
    >
    >
    > --
    > robertjtucker
    > ------------------------------------------------------------------------
    > robertjtucker's Profile:

    http://www.excelforum.com/member.php...o&userid=21805
    > View this thread: http://www.excelforum.com/showthread...hreadid=471783
    >


    One way....ensure all cells in your range have a value then HIDE what you
    want to keep and delete all remaining visible rows within the range:

    <snipped from larger macro filtering data to just those records occuring
    within last month>
    'ensure all rows have a date
    finalrow = range("B65536").End(xlUp).Row
    With Range("B1:B" & finalrow)
    ..SpecialCells(xlCellTypeBlanks).Value = 0
    ..NumberFormat = "mm-dd-yy"
    End With

    'hide last month's data then delete all remaining visible rows within the
    data range
    BOM = "<" & DateSerial(Year(Now), Month(Now) - 1, 1)
    EOM = ">" & DateSerial(Year(Now), Month(Now), 0)
    With Range(Cells(1, 1), Cells(finalrow, 7))
    ..AutoFilter Field:=2, Criteria1:=BOM, Operator:=xlOr, Criteria2:=EOM
    ..Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
    ..SpecialCells(xlCellTypeVisible).EntireRow.Delete
    End With
    ActiveSheet.AutoFilterMode = False 'turn off autofilter

    <end snip>



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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