J
Joanne
Hello, I have the following code which keeps telling me that I don't have an
"End If" defined, but I have the right amount of Ifs and End Ifs. I think
the problem is in the "Exit For" statement because if I remove it and do a
regular If test then it doesn't error out. Am I doing something wrong with
the Exit For? It's only the second time I've used it. Thank you in advance
for your help.
If Len(Trim(vstrSearch)) > 0 Then
If vstrResult > 0 Then
straryElement = Split(vstrSearch, ",")
intFinalNumber = UBound(straryElement)
End If
For intCounter = 0 To intFinalNumber
'ReDim Preserve straryAllElements(1, intLast)
intPos = InStr(straryElement(intCounter), ",")
If intPos = 0 Then Exit For
strArayAllElements(0, intFinalNumber) =
Left(straryElement(intCounter), intPos - 1)
strArayAllElements(1, intFinalNumber) =
Mid(straryElement(intCounter), intPos + 1)
'intLast = intLast + 1
End If
Next intCounter
End If
"End If" defined, but I have the right amount of Ifs and End Ifs. I think
the problem is in the "Exit For" statement because if I remove it and do a
regular If test then it doesn't error out. Am I doing something wrong with
the Exit For? It's only the second time I've used it. Thank you in advance
for your help.
If Len(Trim(vstrSearch)) > 0 Then
If vstrResult > 0 Then
straryElement = Split(vstrSearch, ",")
intFinalNumber = UBound(straryElement)
End If
For intCounter = 0 To intFinalNumber
'ReDim Preserve straryAllElements(1, intLast)
intPos = InStr(straryElement(intCounter), ",")
If intPos = 0 Then Exit For
strArayAllElements(0, intFinalNumber) =
Left(straryElement(intCounter), intPos - 1)
strArayAllElements(1, intFinalNumber) =
Mid(straryElement(intCounter), intPos + 1)
'intLast = intLast + 1
End If
Next intCounter
End If