+ Reply to Thread
Results 1 to 2 of 2

Remove Lines Based on Key Lookup

  1. #1
    Registered User
    Join Date
    06-06-2014
    Posts
    2

    Remove Lines Based on Key Lookup

    Short backstory of the objective:
    I have an expense report, and if the employee itemized the expense (split it out), the itemizations AND the total expense line item show up on the report (so the amount is duplicated). The report has two different key columns: Entry Key (primary key for every expense line item), and then Parent Key (blank, unless it's an itemization, and this is the Entry Key of its parent). I essentially need to scan the second column for any parent keys, and if it finds one (aka column 2 is not blank for that row), then lookup that parent key in the Entry Key column (col 1). When it finds the parent, delete that line from the spreadsheet.

    Here is what I currently have, which has been adapted from another search/remove loop I had written (that works fine). I'm struggling with the match function, where it looks up the parent key in the entry key column.

    I'm fairly new to the VBA side of Excel, so I could be missing something obvious. Thanks in advance for any help!

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    06-06-2014
    Posts
    2

    Lightbulb Re: Remove Lines Based on Key Lookup

    I solved it by replacing the above with the following. The biggest hold-up was because there could be several lines with the same parent key, the fn would halt when it looked up a value in the first column that it had already deleted.

    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)

Similar Threads

  1. [SOLVED] Macro neede to open text files from folder and remove all the lines except specific lines
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-07-2014, 02:44 AM
  2. [SOLVED] Macro to remove certain lines based on barcode format
    By ciuncky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-10-2014, 07:38 AM
  3. Replies: 1
    Last Post: 01-29-2012, 10:51 AM
  4. How to remove these lines
    By Little Master in forum Excel General
    Replies: 2
    Last Post: 10-23-2008, 06:33 AM
  5. Remove lines without a value in column M?
    By Claude-Smith in forum Excel General
    Replies: 4
    Last Post: 09-05-2007, 09:51 AM

Tags for this Thread

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