Excell delete row where column A = column B

Closed
sipherx - Feb 24, 2012 at 07:42 AM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Feb 24, 2012 at 02:19 PM
Hello,

This should be simple but I can't find the solution. I need to delete rows from a spreadsheet where column A = column B.

Please help.


3 responses

nethoorn Posts 2 Registration date Friday February 24, 2012 Status Member Last seen February 24, 2012
Feb 24, 2012 at 10:03 AM
If you want to delete column A but maintain the values in column B you have to copy over the with copy as the values from A to B first. Then delete column A.
0
I need to remove the entire row or record for column A and B if A = B.

ex.

A B
1 1
2 5
18 18
6 90

keep
2 5
6 90
0
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 491
Feb 24, 2012 at 02:19 PM
Hi,

You can do it by using a VBA macro :

Public Sub DELETE_Rows_rowA_id_rowB()  
Dim x As Long  
Dim y As Long  
x = Range("A65536").End(xlUp).Row  

For y = x To 2 Step -1  

    If Cells(y, 1).Value = Cells(y, 2).Value Then  
      
        Rows(y).Delete  
      
    End If  

Next y  
End Sub  


Best regards

"Pour trouver une solution à ses problèmes, il faut s'en donner la peine."
0