I wrote the following code to check is the value of the cell is larger than the 5 cells after it and the 4 cells before it. I am not sure why but it does not seem to output anything. Any advice?
Set FirstCell = Cells(5, 1)
No = 5
For i = 0 To (Last_Row2)
If FirstCell.Offset(i, 0) > FirstCell.Offset(i + 1, 0) Then
If FirstCell.Offset(i + 2, 0) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i + 3, 0) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i + 4, 0) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i + 5, 0) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i - 1) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i - 2) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i - 3) < FirstCell.Offset(0, 0) Then
If FirstCell.Offset(i - 4) < FirstCell.Offset(0, 0) Then
Max = FirstCell.Offset(0, 0).Value
Range(Cells(No, 10)).Value = Max
No = No + 1
End If
End If
End If
End If
End If
End If
End If
End If
End If
Next i