+ Reply to Thread
Results 1 to 18 of 18

Macro to remove all the rows that have no cell value = N/A

  1. #1
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Macro to remove all the rows that have no cell value = N/A

    Hi guys,

    i did a big report in order to see which clients i have now in the current report and which were not into the past ones.

    So I used this vlookup function and i want to remove the rest of the rows that have no value N/A into col.K

    Can you please advise how can I do this macro?

    Thank you,
    Ionut
    Last edited by IonutC; 03-04-2016 at 02:25 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to remove all the rows that have no cell value = N/A

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Macro to remove all the rows that have no cell value = N/A

    Thanks man! However I got an error that I have to dim the rngFind. I think this is range no?

  4. #4
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi mehmetcik Is not working also with range

    Thank you,
    Ionut

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to remove all the rows that have no cell value = N/A

    Have you set this to option explicit?

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi,

    Is still not working.
    rng.png
    Thank you,
    Ionut

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to remove all the rows that have no cell value = N/A

    you need to define the variable rngFind as a range.

    You do not need a code. Just filer the column by N#A and delete the rows. You can also include if error with the lookup error.
    If you have a formula with errors and want a code, try this one.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi,

    I wrote this macro to find the value "#N/A" but i don;t know how to add it into a loop.
    The value is only into col.K but i want it to be part of a loop.
    Please Login or Register  to view this content.

    Thank you!
    Ionut

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to remove all the rows that have no cell value = N/A

    Hello IonutC,

    The Code mehmetcik, gave you works flawlessly, even without Option Explicit.

    It works for me on a Workbook I have setup for this issue, but if you still have problems with it, it might be that your Workbook contains other Code Criteria, which might be playing silly buggers with us.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachements to open the upload window.

    View Pic

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to remove all the rows that have no cell value = N/A

    Hello IonutC,

    Here is a shorter macro that will do the job.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi Leith,

    Don't know what I am missing, you Code doesn't do it for me.

    This however seems to work:
    Please Login or Register  to view this content.
    King regards.

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to remove all the rows that have no cell value = N/A

    Post was duplicated, and removed.
    Last edited by Winon; 03-07-2016 at 03:13 PM.

  13. #13
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Macro to remove all the rows that have no cell value = N/A

    Quote Originally Posted by IonutC View Post
    Hi,

    Is still not working.
    Attachment 449559
    Thank you,
    Ionut
    in your dim statement, you have rngFind spelled wrong, you have Dim rngFing

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to remove all the rows that have no cell value = N/A

    You do not need to loop over the rows, use a simple filter code.

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to remove all the rows that have no cell value = N/A

    Hello Tjaart,

    I ran the code on my laptop with Vista as a double check and it worked with no problems.

    The only difference is you removed the code to check if the cell contains an error. Not sure what the problem would be. VarType is a standard VBA function.

  16. #16
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi Leith,

    I have again tested your code with the VarType etc. extensively, and it still does not come to the Party in Excel 2010

  17. #17
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: Macro to remove all the rows that have no cell value = N/A

    Hi guys,

    I want to THANK YOU!

    You really helped me a lot and I hope i will become an expert also in time.
    I started to learn the code 2 month ago so all your help is really needed!

    Have a great week ahead,
    ionut

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to remove all the rows that have no cell value = N/A

    Hello IonutC,

    You are welcome, glad we could help.

    Thank you for adding to my Reputation!

    Regards.

+ 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. macro remove rows
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2015, 02:57 AM
  2. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  3. vba macro to remove rows if different from specific cell
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2011, 01:28 PM
  4. How to remove unique rows (macro)?
    By davidparkes in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2011, 03:26 PM
  5. How to remove unique rows (macro)?
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-04-2011, 01:45 PM
  6. Macro to remove rows
    By horseyshoe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2006, 12:13 PM
  7. Need macro to remove blank rows
    By Bob in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2006, 08:25 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