Forum Discussion

Re: Combine consecutive rows only if column is blank. Please advice

AndreiMone 

Here is a macro you can run:

 

Sub Condense()
    Dim r As Long
    Application.ScreenUpdating = False
    r = 2
    Do
        Do While Range("B" & r + 1).Value <> "" And _
                Range("C" & r + 1).Value = "" And _
                Range("D" & r + 1) = ""
            Range("B" & r).Value = Range("B" & r).Value & _
                " " & Range("B" & r + 1).Value
            Range("B" & r + 1).EntireRow.Delete
        Loop
        r = r + 1
    Loop Until Range("B" & r).Value = ""
    Application.ScreenUpdating = True
End Sub

 

Others will probably come up with a formula or Power Query solution.

No RepliesBe the first to reply

Resources