Im trying to find all the max and the min in the data set by the slopes and for some reason my if statement wont work
If 0 > ((Cells(i + 1, 2).Value - Cells(i, 2).Value) / (Cells(i + 1, 1).Value - Cells(i, 1).Value)) And 0 < ((Cells(i + 2, 2).Value - Cells(i + 1, 2).Value) / (Cells(i + 2, 1).Value - Cells(i + 1, 1).Value)) Then
Cells(i, 2).Font.Color = vbBlue And Range("A" & i + 1).Value = Range("D" & X).Value And Range("B" & i + 1).Value = Range("E" & X).Value And X = X + 1
ElseIf 0 <= ((Cells(i + 1, 2).Value - Cells(i, 2).Value) / (Cells(i + 1, 1).Value - Cells(i, 1).Value)) And 0 >= ((Cells(i + 2, 2).Value - Cells(i + 1, 2).Value) / (Cells(i + 2, 1).Value - Cells(i + 1, 1).Value)) Then
Cells(i, 2).Font.Color = vbRed And Range("A" & i).Value = Range("F" & X).Value And Range("B" & i).Value = Range("G" & X).Value And X = X + 1
End If
can some one help me
If 0 > ((Cells(i + 1, 2).Value - Cells(i, 2).Value) / (Cells(i + 1, 1).Value - Cells(i, 1).Value)) And 0 < ((Cells(i + 2, 2).Value - Cells(i + 1, 2).Value) / (Cells(i + 2, 1).Value - Cells(i + 1, 1).Value)) Then
Cells(i, 2).Font.Color = vbBlue And Range("A" & i + 1).Value = Range("D" & X).Value And Range("B" & i + 1).Value = Range("E" & X).Value And X = X + 1
ElseIf 0 <= ((Cells(i + 1, 2).Value - Cells(i, 2).Value) / (Cells(i + 1, 1).Value - Cells(i, 1).Value)) And 0 >= ((Cells(i + 2, 2).Value - Cells(i + 1, 2).Value) / (Cells(i + 2, 1).Value - Cells(i + 1, 1).Value)) Then
Cells(i, 2).Font.Color = vbRed And Range("A" & i).Value = Range("F" & X).Value And Range("B" & i).Value = Range("G" & X).Value And X = X + 1
End If
can some one help me