Editing a macro for merging same rows in A to one row with different meanings in column B

osmanoca

Board Regular
Joined
Apr 16, 2016
Messages
87
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
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
osmanoca,

In order to continue I would like to see your actual raw data workbook/worksheet, and, in another worksheet (manually formatted by you) with the results that you are looking for.

You can post your workbook/worksheets to the following free site (sensitive data changed), mark the workbook for sharing, and, provide us with a link to your workbook:

https://dropbox.com
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,884
Members
449,477
Latest member
panjongshing

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top