VBA loop to reconcile and delete entier rows

MarcRowing

New Member
Joined
Jan 16, 2019
Messages
2
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
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

BarryL

Well-known Member
Joined
Jan 20, 2014
Messages
1,421
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
 

Watch MrExcel Video

Forum statistics

Threads
1,102,510
Messages
5,487,310
Members
407,590
Latest member
Grobler

This Week's Hot Topics

Top