Merge Duplicates that are touching in a Column

KORKIS2

Board Regular
Joined
Jun 5, 2015
Messages
143
I am trying to find a code that will go down an individual Column and merge all the same cells that are touching.

Something like this
88
88
88
91
91
78
78
88
88
88

To this
88


91


78


88

.........


Here is code that I Found that is Similar.


PHP:
Dim MY_ROWS As LongDim MY_LINK As String     Application.ScreenUpdating = False    Range("A1").Resize(Range("A65536").End(xlUp).Row, Range("IV16").End(xlToLeft).Column).Borders.LineStyle = xlContinuous    For MY_ROWS = Range("A65536").End(xlUp).Row To 2 Step -1        If Range("B" & MY_ROWS).Value = Range("B" & MY_ROWS - 1).Value Then            Range("A" & MY_ROWS & ":C" & MY_ROWS).ClearContents        End If    Next MY_ROWS    For MY_ROWS = Range("D65536").End(xlUp).Row To 17 Step -1        If Range("A" & MY_ROWS).Value = "" Then            Range(Range("A" & MY_ROWS), Range("A" & MY_ROWS).End(xlUp)).Select            Range(Range("A" & MY_ROWS), Range("A" & MY_ROWS).End(xlUp)).MergeCells = True            Range(Range("B" & MY_ROWS), Range("B" & MY_ROWS).End(xlUp)).MergeCells = True            Range(Range("C" & MY_ROWS), Range("C" & MY_ROWS).End(xlUp)).MergeCells = True            MY_ROWS = MY_ROWS - Selection.Cells.Count + 1        End If    Next MY_ROWS    For MY_ROWS = 1 To Range("D65536").End(xlUp).Row        MY_LINK = Range("D" & MY_ROWS).Value        ActiveSheet.Hyperlinks.Add Anchor:=Range("D" & MY_ROWS), Address:= _            MY_LINK, TextToDisplay:=Range("D" & MY_ROWS).Value    Next MY_ROWS    With Range("A17:D" & Range("D65536").End(xlUp).Row)        .HorizontalAlignment = xlLeft        .VerticalAlignment = xlCenter    End With    Application.ScreenUpdating = False
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,203,734
Messages
6,057,054
Members
444,902
Latest member
ExerciseInFutility

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