+ Reply to Thread
Results 1 to 6 of 6

Macro to delete rows once #N/A is found in a cell

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Macro to delete rows once #N/A is found in a cell

    Hello,
    I'm looking for a macro that scans through 5000 rows of data and as soon as it find #N/A in a particular cell under Column "C", deletes that row and the next 20 rows from the worksheet. Please help!

  2. #2
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Macro to delete rows once #N/A is found in a cell

    Here is what you need... I found this and modified and seems to work fine. Test it first so you don't delete good data.

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro to delete rows once #N/A is found in a cell

    Deleted.
    Edit: Read incorrectly about 20 cells offset
    Last edited by HSV; 03-28-2013 at 05:51 PM.
    Kind regards, Harry.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro to delete rows once #N/A is found in a cell

    Another option:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-26-2013
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro to delete rows once #N/A is found in a cell

    Thanks all of you for your replies. My problem is that I'm using a macro to copy paste data from like 7 different tabs and paste it on one tab. Since I copy a range, there are a bunch of empty rows below #N/A cell. The N/A cell is since I have multiple dropdowns and If i dont select a dropdown it shows up as N/A. Now since I may have to do this operation 5 times, since my selection would change, my new sheet may not be sheet1. Thus the above macro would only work for Sheet1 not the current sheet. Could you change the code so that it deletes these rows in the current selected worksheet rather than sheet1

  6. #6
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Macro to delete rows once #N/A is found in a cell

    I think you want to change the line:

    Please Login or Register  to view this content.
    To this:

    Please Login or Register  to view this content.

+ 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