dual column matching and deleting NON duplicating numbers/rows

horus9484

New Member
Joined
Oct 23, 2014
Messages
2
HI,

I am new to this site. I wanted to say thanks in advance to anybody who tries to help me tackle my questions.

I am trying to match numbers in one column 1 with numbers in column 2. Not only do I want to recognize the numbers that are duplicated but delete the rows with numbers that are not duplicates. Any help would be appreciated.

Thanks!!!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Code:
Sub hilightandremove()


Dim a As Range
Dim b As Range
Dim found As Boolean
Dim p As Integer
p = 3


For Each a In Range("A1:a999")


    If a.Value = "" Then Exit For
    
    For Each b In Range("B1:B999")
        
        If b.Value = "" Then Exit For
        
            If a.Value = b.Value Then
                
                a.Interior.ColorIndex = p
                b.Interior.ColorIndex = p
                            
            End If
        
    Next b
    
p = p + 1
Next a


For Each a In Range("A1:B9999")


    If a.Interior.ColorIndex = -4142 Then
        
        a.ClearContents
    End If


Next a


    
        
End Sub
 
Upvote 0
would the two values be in the same row?

I would like the two values to be in the same row. Right now they are in different columns and in different rows. I would like to remove the non duplicated numbers and place the same numbers side by side in the same rows, just different columns.
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,939
Members
449,134
Latest member
NickWBA

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