+ Reply to Thread
Results 1 to 4 of 4

Trying to create a macro to delete entire rows based on a helper column having an account#

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    indiana, usa
    MS-Off Ver
    Excel 2010
    Posts
    35

    Trying to create a macro to delete entire rows based on a helper column having an account#

    I have a macro setup to create a helper column and paste a vlookup formula to return wether or not an account number matches on another sheet or not. Now i need the macro to delete the rows that have the matching account numbers but keep the rows that have a n/a where it doesn't match. ANy help?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Trying to create a macro to delete entire rows based on a helper column having an acco

    Look at notes throughout the code. I could not tell what the result of the VLOOKUP is. If the result is a 1/0 (True/False), or simply when the acct # matches the acct# is returned, and assuming the acct# is in fact a number and not an alphanumeric string, the following should suffice.

    Please Login or Register  to view this content.
    Last edited by AlvaroSiza; 04-19-2012 at 10:41 AM.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  3. #3
    Registered User
    Join Date
    04-18-2012
    Location
    indiana, usa
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Trying to create a macro to delete entire rows based on a helper column having an acco

    The cell format for the helper column is set to general. If a result is matched it shows the account #, other wise it has the #n/a thing. Does this help? WIth the code you gave me it would still not work, . Any ideas what I need to do, I just want it to delelete any row that doesnt end with "#N/A"

    Quote Originally Posted by AlvaroSiza View Post
    Look at notes throughout the code. I could not tell what the result of the VLOOKUP is. If the result is a 1/0 (True/False), or simply when the acct # matches the acct# is returned, and assuming the acct# is in fact a number and not an alphanumeric string, the following should suffice.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Trying to create a macro to delete entire rows based on a helper column having an acco

    Try changing this line

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Please be as detailed as possible when stating that something 'does not work'. Were there error pop-ups? What was the description of the error? Etc.

+ 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