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
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top