Hello everyone
I have a code that merge similar cells in column
Sub Merge_Similar_Cells()
Dim WorkRng As Range
Dim Rng As Range
Dim xRows As Integer
Dim I As Integer
Dim J As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set WorkRng = Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
xRows = WorkRng.Rows.Count
For Each Rng In WorkRng.Columns
For I = 1 To xRows - 1
For J = I + 1 To xRows
If Rng.Cells(I, 1).Value <> Rng.Cells(J, 1).Value Then
Exit For
End If
Next J
WorkRng.Parent.Range(Rng.Cells(I, 1), Rng.Cells(J - 1, 1)).Merge
I = J - 1
Next I
Next Rng
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
I need to merge two more adjacent columns but depending on the similar values in first column
The Columns A / B / C are the main data and I have put the expected output (desired results) in Columns F / G / H (Just for clarify the issue)
But I need the working code to deal with columns A / B / C
Hope it is clear
Thanks advanced for help
Bookmarks