I have a sheet with 8 columns and more than 63.000 rows,, and I would like to merge cells in one column where the string is the same.
I tried the macro below, but every time it's going to NOT RESPONDING / maybe because of the loop, but I don't have any idea how to fix it.
##########################
Option Explicit
Sub Merge_Same_Cells()
Application.DisplayAlerts = False
Dim rng As Range
MergeCells:
For Each rng In Selection
If rng.Value = rng.Offset(1, 0).Value And rng.Value <> "" Then
Range(rng, rng.Offset(1, 0)).Merge
Range(rng, rng.Offset(1, 0)).HorizontalAlignment = xlCenter
Range(rng, rng.Offset(1, 0)).VerticalAlignment = xlCenter
GoTo MergeCells
End If
Next
End Sub
I tried the macro below, but every time it's going to NOT RESPONDING / maybe because of the loop, but I don't have any idea how to fix it.
##########################
Option Explicit
Sub Merge_Same_Cells()
Application.DisplayAlerts = False
Dim rng As Range
MergeCells:
For Each rng In Selection
If rng.Value = rng.Offset(1, 0).Value And rng.Value <> "" Then
Range(rng, rng.Offset(1, 0)).Merge
Range(rng, rng.Offset(1, 0)).HorizontalAlignment = xlCenter
Range(rng, rng.Offset(1, 0)).VerticalAlignment = xlCenter
GoTo MergeCells
End If
Next
End Sub