delete entire row if present a difference....

sal21

Active Member
Joined
Apr 1, 2002
Messages
291
macro1)

... i have a sheet with many data for example A3:R65536 in the column I and J are present a number. My problem is to delete entire row if the difference value is <>0.

Example in the cell I230 is 1000 int cell J230 is 999 delete entire column... (difference =1)

macro 2)

Make another same macro with two verifycation compare I ad J and K and L

if the I <> J and K<>L delete entire row.

make this do until A is blank in every two case

Tks.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hello,

Try these two macros

Code:
Sub DELETE_DIFF()
For MY_ROWS = 65536 To 3 Step -1
'For MY_ROWS = Range("J65536").End(xlUp).Row To 3 Step -1
    If Range("J" & MY_ROWS).Value - Range("I" & MY_ROWS).Value <> 0 Then
        Rows(MY_ROWS).Delete
    End If
Next MY_ROWS
End Sub

Sub DELETE_DIFF_2()
For MY_ROWS = 7 To 3 Step -1
'For MY_ROWS = Range("J65536").End(xlUp).Row To 3 Step -1
    If Range("J" & MY_ROWS).Value <> Range("I" & MY_ROWS).Value And _
        Range("J" & MY_ROWS).Value <> Range("I" & MY_ROWS).Value Then
        Rows(MY_ROWS).Delete
    End If
Next MY_ROWS
End Sub

If the data doesn't go to ror 65536 use the line with the 'at the beginning (delete the ' and put a ' at the from of the line above).

Any use?
 
Upvote 0
onlyadrafter said:
Hello,

Try these two macros

Code:
Sub DELETE_DIFF()
For MY_ROWS = 65536 To 3 Step -1
'For MY_ROWS = Range("J65536").End(xlUp).Row To 3 Step -1
    If Range("J" & MY_ROWS).Value - Range("I" & MY_ROWS).Value <> 0 Then
        Rows(MY_ROWS).Delete
    End If
Next MY_ROWS
End Sub

Sub DELETE_DIFF_2()
For MY_ROWS = 7 To 3 Step -1
'For MY_ROWS = Range("J65536").End(xlUp).Row To 3 Step -1
    If Range("J" & MY_ROWS).Value <> Range("I" & MY_ROWS).Value And _
        Range("J" & MY_ROWS).Value <> Range("I" & MY_ROWS).Value Then
        Rows(MY_ROWS).Delete
    End If
Next MY_ROWS
End Sub

If the data doesn't go to ror 65536 use the line with the 'at the beginning (delete the ' and put a ' at the from of the line above).

Any use?

you are simply a WIZARD! TKS.
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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