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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
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,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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