VBA code in Excel 2010 with Windows 7.

hchisholm

New Member
Joined
Sep 26, 2014
Messages
6
Hello all, I'm looking for VBA code that will find duplicates between two columns, but the duplicated value could be in different rows. So I could have a value in column c row 5 and the same value in column b row 132. Any assistance would be greatly appreciated.
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,852
Office Version
  1. 2019
Platform
  1. Windows
Try this:

Code:
Option Explicit
Sub Findupe()


Dim i As Long
Dim j As Long
Dim lr As Long


lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 1 To lr
        For j = 1 To lr
        If Range("B" & j) = Range("A" & i) Then
        MsgBox ("Duplicate in " & Range("B" & j).Address)
        End If
        Next j
    Next i
    
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,108,704
Messages
5,524,416
Members
409,576
Latest member
az168

This Week's Hot Topics

Top