+ Reply to Thread
Results 1 to 8 of 8

Delete NOT filtered Rows having non specific dates from a Column Cells

  1. #1
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Delete NOT filtered Rows having non specific dates from a Column Cells

    File format - Excel 97-2003 (version)

    Rows in Column C, have dates in dd-mmm-yy format.



    Seek a macro that will
    1) check date in Cell C2, C3, C4 which would always have unique dates. (three different dates), and check these three dates in each row in Column C (apply filter ?)
    2) keep only those rows where Dates are matches with either of dates given in Cell C2, or C3, or C4, (pass on date value to some variable, and then compare?)
    3) Delete all rows where Cell in Column C has date other than what is given (passed on to some variable in 1 above !) in C2,C3,C4.

    How macro should be written to filter and do the job and again unfilter it to show all resultant data having only rows where dates are repetative of what is given in Cell C2,C3,C4.

    Sample file attached.
    Current value in
    Cell C2 has 30-Aug-2014 (displayed as dd-mmm-yy)
    Cell C3 has 27-Sep-2014 (displayed as dd-mmm-yy)
    Cell C4 has 25-Oct-2014 (displayed as dd-mmm-yy)

    Only rows having these dates should be retained, and rest entire rows be deleted. (Finally, unfilter it to show all resultant data)

    Thanks
    Attached Files Attached Files
    Last edited by analystbank; 08-21-2018 at 08:02 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Try this.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Thanks but it deleted all data rows. It should have retained all rows where those specific three date appears.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    You need to put the dates in C2,C3,C4, you don't have any dates in those ranges in the sample you provided.

  5. #5
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Ignore this please-----------------------------
    Last edited by analystbank; 08-22-2018 at 02:20 AM.

  6. #6
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Quote Originally Posted by davesexcel View Post
    Try this.

    Please Login or Register  to view this content.
    This code does not delete entire ROW, as required to be done, it simply lifts up those cells.

    It only deletes those cells where those three dates are not matching, and moves it up, causing disturbance in data arrangement, since corresponding data in adjacent columns are retained (not deleting rows)

    Quote Originally Posted by analystbank View Post
    File format - Excel 97-2003 (version)

    Rows in Column C, have dates in dd-mmm-yy format.

    .
    .
    .

    Only rows having these dates should be retained, and rest entire rows be deleted. (Finally, unfilter it to show all resultant data)

    Thanks
    How 'UnionRng' be modified suitably to select entire row and delete it.
    Last edited by analystbank; 08-22-2018 at 02:59 AM.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Your workbook sample should match the question.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    271

    Re: Delete NOT filtered Rows having non specific dates from a Column Cells

    Quote Originally Posted by davesexcel View Post
    Your workbook sample should match the question.


    [/CODE]
    Noted, thank you, Sir. This thread is solved, now.
    Last edited by analystbank; 08-22-2018 at 09:03 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete rows based on two specific dates using a input box
    By sloshpuppy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-16-2018, 06:57 AM
  2. [SOLVED] Copy the filtered dates, do Formatting and paste it back to filtered column
    By Rajkumar_h in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2017, 10:53 AM
  3. Replies: 6
    Last Post: 02-28-2017, 06:21 PM
  4. Delete Rows with specific text in specific column
    By love2waltz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2015, 10:16 AM
  5. [SOLVED] delete rows when column has specific word(s)
    By chrisblackman in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-22-2013, 10:21 PM
  6. Delete Rows With Expired Dates In Column
    By biznez1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2013, 03:04 PM
  7. 2003 Delete rows with specific value in column C
    By koklok in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2009, 12:08 PM

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