Skip to content

Instantly share code, notes, and snippets.

@tmasjc
Created June 7, 2020 09:12
Show Gist options
  • Save tmasjc/0a5daea8cc1e6f325b0a0ce1af6ab058 to your computer and use it in GitHub Desktop.
Save tmasjc/0a5daea8cc1e6f325b0a0ce1af6ab058 to your computer and use it in GitHub Desktop.
Quickly merge cells of same value
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