I am stumped...any ideas why i get the "Next without for" error message?
checkstructure is the name of the function.
My suspicion is the "Exit For" in the Else statement is not allowed?
checkstructure is the name of the function.
My suspicion is the "Exit For" in the Else statement is not allowed?
Code:
Dim STVal As String
STVal = "ST050"
Dim i As Integer
Dim myanswer As Double
Dim myCheckVal As Boolean
For i = 1 To 5
On Error Resume Next
myanswer = WorksheetFunction.Search(STVal & Chr(i), testname, 1)
If Err.Number = xlErrValue Then
Next i
Else
checkstructure = True
Exit For
End If
checkstructure = False
End Function