Hi,

What i want to do is look through 3 lines at one time, if all 3 are true then take the 4th line and paste this next to it.

I am able to get the first line to work however when it comes to looking any further it gets a bit messy.



Code:
CurrentRow = 2
Teamchangecode = 0


Do While Cells(CurrentRow, 3) <> ""
    If CurrentRow = 3 Then
    Teamcode = Cells(CurrentRow, 3).Value
    Else
        If Cells(CurrentRow, 3).Value = "SUB-TOTAL FOR TEAM" Then
            Teamchangecode = 2
                If Cells(CurrentRow + 1, 3).Value = "SUB-TOTAL FOR AGENT CODE" Then
                End If
                    If Cells(CurrentRow, 3).Value = "TOTAL FOR PERIOD" Then
                    EndReport = 1
                    Teamcode = ""
                    End If
                Else
                    If Teamchangecode = 2 Then
                    Teamcode = Cells(CurrentRow, 3).Value
                    Teamchangecode = 0
                    End If
        End If
    End If
        Cells(CurrentRow, 2).Value = Teamcode
        
        CurrentRow = CurrentRow + 1
    Loop

I have attached an example of what i currently getting and how i want it to look in case i haven't explain myself very well.

EXAMPLE.xlsx
Would appreciate any help.