bobbyexcel
Board Regular
- Joined
- Nov 21, 2019
- Messages
- 88
- Office Version
- 365
- Platform
- Windows
Hi, Can someone help me on my below issue please.
I've my data from Col A to F. Trying to remove duplicates from Col A to D and copy the non duplicate data in to E with a delimator.
Now the issue is whenever I run the script, the first 12 days of any month is converted from dd-mm-yyyy to mm-dd-yyyy. My base data is fine and there is no issues. But the only problem is with the script. Could anyone please help me.
Have a look at my data after running the script..
I've my data from Col A to F. Trying to remove duplicates from Col A to D and copy the non duplicate data in to E with a delimator.
Now the issue is whenever I run the script, the first 12 days of any month is converted from dd-mm-yyyy to mm-dd-yyyy. My base data is fine and there is no issues. But the only problem is with the script. Could anyone please help me.
Have a look at my data after running the script..
VBA Code:
Dim lr&, i&, rng, name As String, arr(), key
Dim dic As Object
Set dic = CreateObject("Scripting.dictionary")
lr = Cells(Rows.Count, "A").End(xlUp).Row
rng = Range("A2:F" & lr).Value
For i = 1 To lr - 1
name = rng(i, 1) & "|" & rng(i, 2) & "|" & rng(i, 3) & "|" & rng(i, 4)
If Not dic.exists(name) Then
dic.Add name, rng(i, 6) & ";" & rng(i, 5)
Else
dic(name) = rng(i, 6) & "," & dic(name) & "," & rng(i, 5)
End If
Next
Range("A2:F" & lr).ClearContents
ReDim arr(1 To dic.Count, 1 To 6)
i = 0
For Each key In dic.keys
i = i + 1
arr(i, 1) = Split(key, "|")(0)
arr(i, 2) = Split(key, "|")(1)
arr(i, 3) = Split(key, "|")(2)
arr(i, 4) = Split(key, "|")(3)
arr(i, 5) = dic(key)
Next
Range("A2").Resize(i, 6).Value = arr