+ Reply to Thread
Results 1 to 4 of 4

Delete rows based on Cell Value

  1. #1
    Registered User
    Join Date
    08-02-2022
    Location
    Montclair, NJ
    MS-Off Ver
    MS 365
    Posts
    32

    Delete rows based on Cell Value

    Hello,

    I have Dates in column A,
    and a Date in O1 (this date will change).

    I'm looking for VBA code that will delete the entire row in column A if it doesn't match that date.


    Thank you!
    Robert

    Here is my desired outcome

    Before....
    Before.png


    After....
    After.png
    Attached Files Attached Files
    Last edited by rmathisen; 11-28-2022 at 06:01 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,973

    Re: Delete rows based on Cell Value

    Here is an alternative to VBA. Power Query

    Load your table to the Power Query Editor

    Please Login or Register  to view this content.
    Put your lookup date in O2 and put the name of the field in O1 as Lookup

    Load to the Power Query Editor

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,607

    Re: Delete rows based on Cell Value

    vba
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Delete rows based on Cell Value

    Hello RMathison,

    The ColumnDifferences method could work for you:-

    Please Login or Register  to view this content.
    I'm assuming that the heading in A1 is "Date", which is temporarily replaced by the date in O1, and then is re-instated once the code has executed.
    Please note that this method won't work unless the actual date is 'heading' the same column.

    Please test the code in a copy of your actual workbook.

    I hope that this helps.

    Cheerio,
    vcoolio.

+ 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 cell value, highlight based on cell value and keep deleted data
    By jaredli in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-21-2020, 06:37 AM
  2. [SOLVED] Delete rows based on cell value
    By Pojzon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2018, 03:20 PM
  3. [SOLVED] VBA to delete certain rows based on the value of a cell
    By The_Snook in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-13-2018, 05:28 AM
  4. [SOLVED] delete rows based on cell value
    By shakir1401 in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 12-21-2015, 10:22 AM
  5. Delete rows based on the value of a cell
    By Emma_B in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:35 PM
  6. Delete Rows based on cell value and then Insert rows alternatively with a formula
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-11-2008, 04:27 PM
  7. Delete rows based on Cell name
    By gmunro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2005, 09:15 AM

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