try thisVB Code:
Sub lineup() i = 3 Do Until i = ActiveSheet.UsedRange.Rows.Count If Not IsEmpty(Cells(i, 1)) And Not IsEmpty(Cells(i, 9)) Then If Cells(i, 1) > Cells(i, 9) Then Range(Cells(i, 1), Cells(i, 4)).Insert xlDown ElseIf Cells(i, 1) < Cells(i, 9) Then Range(Cells(i, 9), Cells(i, 13)).Insert xlDown ElseIf Cells(i, 1) = Cells(i, 9) Then If Cells(i, 2) > Cells(i, 10) Then Range(Cells(i, 1), Cells(i, 4)).Insert xlDown ElseIf Cells(i, 2) < Cells(i, 10) Then Range(Cells(i, 9), Cells(i, 13)).Insert xlDown End If End If End If i = i + 1 Loop End Sub




Reply With Quote