delete entire row if present a difference....

sal21

Board Regular
Joined
Apr 1, 2002
Messages
231
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.
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
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?
 

sal21

Board Regular
Joined
Apr 1, 2002
Messages
231
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,399
Messages
5,601,459
Members
414,451
Latest member
jrose7

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
Top