# Merge similar cells in column

#### KORKIS2

##### Board Regular
Lets say this is the column
88
88
78
78
99
99
99
99

I want the macro to search down the column and merge all the cells that are similar
so it will them look something like this.
88

78

99

Thank you

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.
This is close but I only want it to merge Column A and this seems to delete extra cells not merge them.

Dim MY_ROWS As Long

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 = 17 To Range("D65536").End(xlUp).Row
Next MY_ROWS
With Range("A17:D" & Range("D65536").End(xlUp).Row)
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
Application.ScreenUpdating = False

Replies
21
Views
202
Replies
5
Views
92
Replies
6
Views
39
Replies
9
Views
82
Replies
3
Views
238

1,203,221
Messages
6,054,224
Members
444,711
Latest member
Stupid Idiot

### 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.

### Which adblocker are you using?

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

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