Results 1 to 7 of 7

Thread: Delete Filtered Result, Sort From Specific Row And Delete Entire Row Having No Pairs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    Aug 2013
    Posts
    59
    Rep Power
    11

    Delete Filtered Result, Sort From Specific Row And Delete Entire Row Having No Pairs

    Row 1 is the header so, it should not be deleted
    Data Range starts from A2 and across column O, and rows could vary from 25000+
    Now Macro should perform as under

    1) First delete all rows where cell in Column F is numeric 0 (Zero), so I write code as under (using filter)
    Code:
        Selection.AutoFilter
        Selection.AutoFilter Field:=5
        Selection.AutoFilter Field:=6, Criteria1:="0"
        Range("F2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.EntireRow.Delete
    2) Read DATE Data from Cell C2, and if similar DATE is not found in subsequent rows till end (which could run down to some 25000+ rows), delete such entire row. So, All cells in Column 2 should be equal to date in Cell C2, if not delete entire row.

    3) Now Cells in 5th Column i.e Column E , starting from Cell E2 contains 3 type of text data, either 'XX', 'YY', or 'ZZ'.

    4) So, macro should start sorting only from rows where text 'XX' in column E ends, and for rest of the rows(Range A:O) below it should be sorted in following order
    Code:
    Selection.Sort Key1:=Range("B"), Order1:=xlAscending, Key2:=Range("D") _
            , Order2:=xlAscending, Key3:=Range("E"), Order3:=xlAscending, Header:= _
            xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
            xlSortNormal
    In above code, Range("B"), Range("D"), Range("E"), I guess should be supplemented with row number, which I don't know how to code, and where Data in Column E 'XX' ends.

    5) Once above is being done, Data would look like, starting from A2, all data having 'XX' in Column E. Once this 'XX' in column E Ends, due to Sort function being done in 4 above, rest of the data would be like a pair, based on Column B, Column D, Column E, showing data in each rows in Column E having 'YY', followed in subsequent row by 'ZZ'.

    6) Now comparison should begin from row (where data in Column E having text data 'XX' ends), and has pair of data 'YY', followed by'ZZ' in following rows, one below other.

    7) So, based on Sorting on Clumn B,D,E, if pair of YY, and ZZ is not made, then such data should be deleted.
    Attached Files Attached Files
    Last edited by analyst; 03-17-2014 at 12:08 PM.

Similar Threads

  1. Replies: 1
    Last Post: 02-25-2014, 10:55 PM
  2. Replies: 10
    Last Post: 02-18-2014, 01:34 PM
  3. Delete Entire Row For All Empty Cells In Column
    By johnreid7477 in forum Excel Help
    Replies: 4
    Last Post: 06-15-2013, 05:50 AM
  4. Delte a specific column and does not delete the top row
    By jffryjsphbyn in forum Excel Help
    Replies: 1
    Last Post: 06-13-2013, 02:00 PM
  5. Replies: 4
    Last Post: 03-22-2013, 01:47 PM

Posting Permissions

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