Try this
Sub Test()
For N = Cells(Rows.Count, 7).End(xlUp).Row To 3 Step -1
If Cells(N, 1) = "" Then
If Cells(N - 1, 7) = "" Then
Range(Cells(N, 7), Cells(N, 7).End(xlToRight)).Cut Destination:=Cells(N - 1, 7)
Else
Range(Cells(N, 7), Cells(N, 7).End(xlToRight)).Cut Destination:=Cells(N - 1, 7).End(xlToRight).Offset(0, 1)
End If
Rows(N).Delete
End If
Next N
End Sub
Open up the VBA editor by hitting ALT F11
Insert a new module by hitting Insert - Module
Paste the macro into the empty sheet
Hit ALT F11 to get back to the worksheet.
Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010.
Bookmarks