Use in Scripting.Dictionary- item join string 3col
Solved/Closed
mokie1
Posts
2
Registration date
Wednesday March 28, 2018
Status
Member
Last seen
March 28, 2018
-
Updated on Mar 28, 2018 at 04:59 PM
mokie1 Posts 2 Registration date Wednesday March 28, 2018 Status Member Last seen March 28, 2018 - Mar 28, 2018 at 12:37 PM
mokie1 Posts 2 Registration date Wednesday March 28, 2018 Status Member Last seen March 28, 2018 - Mar 28, 2018 at 12:37 PM
Related:
- Use in Scripting.Dictionary- item join string 3col
- Every item in little alchemy - Guide
- Vba select case string contains - Guide
- Excel count occurrences of string in column - Guide
- Unexpected t string php - Guide
- How to disable recover deleted items in outlook mail - Guide
1 response
mokie1
Posts
2
Registration date
Wednesday March 28, 2018
Status
Member
Last seen
March 28, 2018
Mar 28, 2018 at 12:37 PM
Mar 28, 2018 at 12:37 PM
I don't know is that solution is perfect but it works:)
Option Explicit
Sub DicSolve() 'Excel VBA find duplicates with the scripting dictionary.
Dim ar As Variant
Dim i As Long
Dim j As Long
Dim n As Long
'Dim dict As Object
ar = Sheet2.Cells(1, 3).CurrentRegion.Value
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
'.CompareMode = vbTextCompare
For i = 2 To UBound(ar, 1)
.Item(ar(i, 1) & "|" & ar(i, 2) & "|" & ar(i, 3)) = Empty
Next
ar = Sheet1.Cells(1).CurrentRegion.Value
n = 1
For i = 2 To UBound(ar, 1)
If .exists(ar(i, 1) & "|" & ar(i, 2) & "|" & ar(i, 3)) Then
'do nothing
Else
n = n + 1
For j = 1 To UBound(ar, 2)
ar(n, j) = ar(i, j)
Next
End If
Next
End With
Sheet3.Cells(10, 1).Resize(n, UBound(ar, 2)).Value = ar
End Sub