+ Reply to Thread
Results 1 to 10 of 10

Need a macro that will delete a line when "#n/a" appears

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17
    I need some help in finding a macro that will delete a line if the message #N/A appears. Right now I have a macro that will hide a row if it has a zero in it and it loops all the way till it hits "done" would like to add the ability to delete a row with #N/A in it, here is my code for the hide zero macro
    Please Login or Register  to view this content.
    Any help would be awesome, thanks!
    Last edited by Paul; 06-09-2009 at 04:31 PM. Reason: Merged post without code tags and last post with code tags.

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Need a macro that will delete a line when "#n/a" appears

    Firstly, you need to add code tags to your post or else you will get your knuckles rapped.
    Edit your post, then click the Advanced button, highlihgt the code, and click the
    Please Login or Register  to view this content.
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  3. #3
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need a macro that will delete a line when "#n/a" appears

    thanks for the code Phil, i tried running it and it gave me an error when i hit the #n/a, I don't know if it makes a difference but i copy and paste special values the data into the cells so that the sheet I have doesn't have to recalculate, do you think that would have any affect on it not working?

  4. #4
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Need a macro that will delete a line when "#n/a" appears

    What was the error given?

    Is the "#N/A" the actual text in the cell, or an Excel error message, or what is displayed after some custom formatting?

    Is it "#N/A", "#n/a" or "N/a" ? It may be that the case is wrong, but I can't really help anymore without having a copy of the data, or at least knowing what the 'error' was that you got.

  5. #5
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need a macro that will delete a line when "#n/a" appears

    The error says Run Time Error '13': Type Mismatch

  6. #6
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need a macro that will delete a line when "#n/a" appears

    the cell contains #N/A as the actual text, but it isn't the error message, it is the error message copied and then pasted as a value

  7. #7
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Need a macro that will delete a line when "#n/a" appears

    Can you upload an example workbook worksheet of your data?

  8. #8
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need a macro that will delete a line when "#n/a" appears

    Okay, i have kind of dumbed down the data but I had to in order to post it. What I want to do is delete any row in column E after row 12 that is either a 0 or an #N/A. The workbook eventually will have about 15,000 lines of data to go through so I will also need to copy and paste the data as values before this starts so that it doesn't have to recalculate every time.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-16-2009
    Location
    arkansas
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need a macro that will delete a line when "#n/a" appears

    any ideas?

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Need a macro that will delete a line when "#n/a" appears

    Perhaps something along the lines of the below ?

    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