Hi all,
I want to return the row number the first time all the columns for a certain row have numeric values. My code is as follows:
The problem I have is once the condition is true and I return the row I am still stuck in the loop. How do I break out of the loop once the IF statement is correct? Is there a more efficient way to code this?
Cheers,
James
I want to return the row number the first time all the columns for a certain row have numeric values. My code is as follows:
Code:
Function EcoNumeric()
Dim i As Integer
Dim x As Boolean
x = IsNumeric(Cells(i, 3)) And IsNumeric(Cells(i, 4)) And IsNumeric(Cells(i, 5)) And IsNumeric(Cells(i, 6)) And IsNumeric(Cells(i, 7)) And _
IsNumeric(Cells(i, 8)) And IsNumeric(Cells(i, 9)) And IsNumeric(Cells(i, 10)) And IsNumeric(Cells(i, 11))
For i = 11 To 2000
If x = True Then
EcoNumeric = i
End If
Next i
End Function
The problem I have is once the condition is true and I return the row I am still stuck in the loop. How do I break out of the loop once the IF statement is correct? Is there a more efficient way to code this?
Cheers,
James