Hello, i have a macro in below to merge same rows in to one row. but it is for latin characters(like kurdish-english, english-turkish). so it works in kurdish and turkish. but i have a different file that Column A is turkish and column B is persian. and when i run this macro below it gives error and it deletes everything in file and doesnt work in this kind file. what is problem. please correct this macro to use in persian
my macro is this:
Sub MergeMyData()
' hiker95, 07/22/2017, ME1015455
Dim rng As Range, c As Range
Set rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
For Each c In rng
If Not .Exists(c.Value) Then
.Add c.Value, c.Offset(, 1)
Else
.Item(c.Value) = .Item(c.Value) & ", " & c.Offset(, 1)
End If
Next
rng.Resize(, 2).ClearContents
Range("A1").Resize(.Count, 2) = Application.Transpose(Array(.Keys, .Items))
End With
Cells.EntireColumn.AutoFit
End Sub
my macro is this:
Sub MergeMyData()
' hiker95, 07/22/2017, ME1015455
Dim rng As Range, c As Range
Set rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
For Each c In rng
If Not .Exists(c.Value) Then
.Add c.Value, c.Offset(, 1)
Else
.Item(c.Value) = .Item(c.Value) & ", " & c.Offset(, 1)
End If
Next
rng.Resize(, 2).ClearContents
Range("A1").Resize(.Count, 2) = Application.Transpose(Array(.Keys, .Items))
End With
Cells.EntireColumn.AutoFit
End Sub
Last edited: