Sub twocolscode()
Dim e As Range, d As Object
Dim na As Long, nn As Long, k As Long
Set d = CreateObject("scripting.dictionary")
With Range("A:A")
na = .Cells(Rows.Count, 1).End(3).Row
For Each e In .Resize(na)
d(e.Value) = 1
Next e
End With
With Range("N:N")
nn = .Cells(Rows.Count, 1).End(3).Row
For Each e In .Resize(nn)
If d(e.Value) = 1 Then
k = k + 1
Cells(k + 1, "p") = e.Value
End If
Next e
If k > 1 Then Cells(1, "p") = "> 1"
End With
End Sub
That code looks at all the numbers in Column A, then looks at all the numbers in Column N, then lists in Column P all the numbers that are common to both columns (duplicates).Do not quite understand the code.
I ran but did not work.
What does this code do?
Regarding 1. the following code will find duplicates in Column A. Each item that occurs more than once in Col A is listed in Col C with the number of times it occurs listed in Col D,1, I would like the code looks for duplicates only in the column "A".
2 After you locate the duplicate values if the column "N" if more than one copy and paste the worksheet "2. "
Can you do that?
thanks
Sub colAcode()
Dim e As Range, f, d As Object
Dim na As Long, k As Long
Set d = CreateObject("scripting.dictionary")
With Range("A:A")
na = .Cells(Rows.Count, 1).End(3).Row
For Each e In .Resize(na)
d(e.Value) = d(e.Value) + 1
Next e
End With
For Each f In d
If d(f) < 2 Then d.Remove f
Next f
[c1].Resize(d.Count, 2) = _
Application.Transpose(Array(d.keys, d.items))
End Sub