VBA to delete lines that add up to zero

  • Hi,


    I am looking for a vba code which searches a table for items with same reference, adds of the corresponding amounts . if it adds to zero, delete the items from the table. see below example


    Ref amount
    a102 50
    b156 25
    a102 -50
    a568 12
    a578 10


    So, i will like to search and delete lines 1 and 3 as they add up to zero.


    Thank you

  • Re: VBA to delete lines that add up to zero


    Hi..


    Here's another..


  • Re: VBA to delete lines that add up to zero


    You are spoilt for choice, here is a 3rd method

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: VBA to delete lines that add up to zero


    For the data provided.

  • Re: VBA to delete lines that add up to zero


    granty,


    If you must cross-post please provide a link to the other forum(s) as I have with this link as it will save time for others trying to provide you with a solution (like I have) when you've already received a solution here. So annoying!!


    Robert

  • Hi I am trying to create a vba code that will search through the amounts in Column I and delete the entire row if any cells add up to 0.

    For instance, please see attached, all amounts in Red equal 0 and i would like to delete all the rows, however they are not just negative and positive versions of the same number (20, -20)


    Is this possible?

    Files

    • onsetep .xlsm

      (78.55 kB, downloaded 27 times, last: )
  • Welcome to the Forum


    Please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.


    Read the Forum Rules before continuing.

  • royUK

    Closed the thread.