Hello,
I'm getting a Subcript Out of Range error for an array based on an Excel spreadsheet, and I can see that it is because there is a blank in the cell that the array is attempting to retrieve the element from. I have been trying to get past that error with no success.
For Example:
returns "Subscript Out of Range" rather than True. I can't use an "On Error Resume Next" since I don't want the next lines of script executed.
Here is the part of my script where the problem occurs. The bolded line is where the error occurs. I would like it to exit the If and For statements.
Code
For r = 2 To UBound(cwlaArray, 1)
'Test whether the Customer Code in the CWLA File equals that in the Pyramid file
[B]If cwlaArray(r, 3) = PyrCC[/B] Then
ClientCode = cwlaArray(r, 1)
PyrRow = ecell.Row
Fname2 = "c:\Client Code Files\" & ClientCode & ".xlsx"
WriteRowtoClientFile
Exit For
End If
Next r
Any help is much appreciated.
Brian