Results 1 to 3 of 3

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

  1. #1

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



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

  2. #2

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •