VBA loop to reconcile and delete entier rows
Results 1 to 3 of 3

Thread: VBA loop to reconcile and delete entier rows
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jan 2019
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA loop to reconcile and delete entier rows

    Hi everyone,

    I am struggling to write a loop which needs to do the following:

    Check if Cells(J,1) = Cells(J+1,1) and Cells(J,3) = Cells(J+1,4) when >0 or Cells(J+1,4) = Cells(J,3) when >0
    then delete both the row J and J+1

    I have managed to create a loop that check if Cells are equal (but also when both are = 0) and do not find how to delete them.

    Could you please help me

    Thank you

  2. #2
    Board Regular
    Join Date
    Jan 2014
    Location
    Dublin, Ireland
    Posts
    1,421
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA loop to reconcile and delete entier rows

    if you are deleting in a For loop you will need to step backwards like below.

    can you paste your current code?

    Code:
    For j = lastrow To 1 Step -1
    
    
    'if condition here then
    Rows(j).EntireRow.Delete
    Next
    Learn something new everyday.

    be sure to use code tags

    Code:
    [ code ]
    [ / code ]
    ' no spaces

  3. #3
    New Member
    Join Date
    Jan 2019
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA loop to reconcile and delete entier rows

    Thank you very much!

    I just had to add some more "dim" and your line and it worked

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •