Hey guys,
i have a piece of code that is throwing an error: next i without for at the NextIteration part
I'm trying to make a manual rounding function and sometimes my data is missing values. I was hoping to just skip over the whole cycle if the value is wrong. Fixing this problem here is easy, but i was wondering how could i stop and skip a part of the cycle if a condition is met?
i have a piece of code that is throwing an error: next i without for at the NextIteration part
Code:
For i = 2 To lastRow
variableInQuestionReal = Range("L" & i)
variableInQuestionDecimal = GetDecimal(Range("L" & i), False)
If isError(variableInQuestionReal) = true Then GoTo NextIteration
If variableInQuestionDecimal < 0.9 Then variableInQuestionInt = WorksheetFunction.Floor(variableInQuestionReal, 1)
If variableInQuestionDecimal > 0.9 Then variableInQuestionInt = WorksheetFunction.Ceiling(variableInQuestionReal, 1)
Range("O" & i).Value = variableInQuestionInt
Next i
Exit Sub
NextIteration:
Next i
Last edited: