Hello guys,
i am going through a 100 rows and adding the numbers up together, it sums to a 100. Once it reaches 70, 85, 100, different actions are taken.
This is pretty much a manual conditional format.
My code:
Since my endChecker is not a long but a double, i cannot state that when a certain number is reached do.
Thus the only way i can think of is starting that its over 70, but that's true in every situation after it happens once.
Thus i have the boolean that updates once and then prevents the if from being reached again.
Is there a better way to approach this problem of hitting ifs only once in a cycle?
i am going through a 100 rows and adding the numbers up together, it sums to a 100. Once it reaches 70, 85, 100, different actions are taken.
This is pretty much a manual conditional format.
My code:
Code:
For i = 2 To lastRow
endChecker = range("D" & i).Value + endChecker
If endChecker > 70 And greenCheck = False Then
Set rng = range(Cells(initialX, 1), Cells(i, lastColumn))
Call coloringTables("green", rng)
greenCheck = True
initialX = i + 1
ElseIf endChecker > 85 And yellowCheck = False Then
Set rng = range(Cells(initialX, 1), Cells(i, lastColumn))
Call coloringTables("yellow", rng)
yellowCheck = True
initialX = i + 1
ElseIf endChecker = 100 Then
Set rng = range(Cells(initialX, 1), Cells(i, lastColumn))
Call coloringTables("red", rng)
initialX = i
End If
Next i
Since my endChecker is not a long but a double, i cannot state that when a certain number is reached do.
Thus the only way i can think of is starting that its over 70, but that's true in every situation after it happens once.
Thus i have the boolean that updates once and then prevents the if from being reached again.
Is there a better way to approach this problem of hitting ifs only once in a cycle?