Good afternoon all. Having trouble making this merge of cells work. Need to limit my merge to a specific column and my data in the column changes daily. The macro is merging the cell values as they repeat, but it is bugging out after all the merges are done on If cell.Value = cell.Offset(1, 0).Value And cell.Value <> “” Then. Is it due to the Range("K:K") code going to blank cells and it should be limited to the end of the column data? Or something else. I thought the And cell.Value <> “” Then would satisfy that. I appreciate your help.
Sub test()
'Merge similar cells
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set myRange = Range("K:K")
Check:
For Each cell In myRange
If cell.Value = cell.Offset(1, 0).Value And cell.Value <> “” Then
Range(cell, cell.Offset(1, 0)).Merge
cell.VerticalAlignment = xlCenter
GoTo Check
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub test()
'Merge similar cells
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set myRange = Range("K:K")
Check:
For Each cell In myRange
If cell.Value = cell.Offset(1, 0).Value And cell.Value <> “” Then
Range(cell, cell.Offset(1, 0)).Merge
cell.VerticalAlignment = xlCenter
GoTo Check
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub