Need some help "BOSS WANTS IT DONT TODAY AND IM LOST"

Xcel90pro

New member
Joined
Jun 9, 2014
Messages
6
Reaction score
0
Points
0
I need a program that searches down a column and identifies cells that have the same words and numbers in them that are adjacent to each other and joins them together through the merge tool i have something similar but i found it online and it only seems to do numbers and is very picky. Take a look and maybe you can tweak it.

Sub mergeAlike()
Application.DisplayAlerts = False
Set Rng = ActiveSheet.Range("C1:C30")
x = 1
y = 1
Do
Do While Rng.Cells(x, 1) = Rng.Cells(y, 1) And x <= Rng.Cells.Count

x = x + 1
Loop
If x - y > 2 Then
Range(Rng.Cells(x - 1, 1), Rng.Cells(y, 1)).Merge
End If
y = x
Loop Until y > Rng.Cells.Count
Application.DisplayAlerts = True
End Sub
 

Bob Phillips

Super Moderator
Staff member
Joined
Mar 21, 2011
Messages
1,942
Reaction score
0
Points
36
Excel Version(s)
O365
Code:
Sub mergeAlike()Dim i As Long


    Application.DisplayAlerts = False
    
    For i = 29 To 1 Step -1
    
        If Cells(i, "C").Value = Cells(i + 1, "C").Value Then
        
            Cells(i, "C").Resize(2).Merge
        End If
    Next i
    
    Application.DisplayAlerts = True
End Sub
 
Top