Code:
Sub SwapperTEST33()
ActiveWorkbook.Sheets(1).Activate
Dim cell As Range
Dim v1 As String, v2 As String, id1 As String, id2 As String
For Each cell In Range("F2:F151")
If cell.Value = "Team 1QB" And cell.Offset(0, -1) > 2 Then
v1 = cell.Offset(0, -2).Value
v2 = cell.Offset(1, -2).Value
cell.Offset(0, -2).Value = v2
cell.Offset(1, -2).Value = v1
id1 = cell.Offset(0, -1).Value
id2 = cell.Offset(1, -1).Value
cell.Offset(0, -1).Value = id2
cell.Offset(1, -1).Value = id1
End If
Next cell
End Sub
The above code exchanges the active cells with the cells underneath if the conditions are not meet. however, I need to add a line to have the code run until at least one row matches the following condition:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
If cell.Value = "Team 1QB" And cell.Offset(0, -1) = 2