Merge similar cells in column

KORKIS2

Board Regular
Joined
Jun 5, 2015
Messages
143
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
Dim 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 = 17 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
 
Upvote 0

Forum statistics

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