Created
June 7, 2020 09:12
-
-
Save tmasjc/0a5daea8cc1e6f325b0a0ce1af6ab058 to your computer and use it in GitHub Desktop.
Quickly merge cells of same value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub MergeSimilarCells() | |
Application.DisplayAlerts = False | |
Application.ScreenUpdating = False | |
'Specify column here | |
Set myRange = Range("B2:B223") | |
CheckAgain: | |
For Each cell In myRange | |
If cell.Value = cell.Offset(1, 0).Value And Not IsEmpty(cell) Then | |
Range(cell, cell.Offset(1, 0)).Merge | |
cell.VerticalAlignment = xlCenter | |
GoTo CheckAgain | |
End If | |
Next | |
Application.DisplayAlerts = True | |
Application.ScreenUpdating = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment