Automate Merge
Hi John
thanks for sending a more detailed explanation of your problem.
Max's solution looks good, although it doesn't delete your lines.
Following VBA Code should do what you need:
Sub CleanUp()
Dim SH As Worksheet
Dim Col As Integer
Set SH = Worksheets("Sheet1")
Col = 3
For i = SH.Cells(65536, Col).End(xlUp).Row To 2 Step -1
If SH.Cells(i, 1) = "" Then
SH.Cells(i - 1, Col).Value = _
SH.Cells(i - 1, Col).Value & SH.Cells(i, Col).Value
SH.Rows(i).Delete
End If
Next i
End Sub
You have to adjust SH and Col according to your sheet. I used column
one for checking if the line needs to be deleted, hope that is ok,
otherwise you need to change that as well.
I hope you understand what it does, otherwise just ask.
hth
Carlo
|