[RESOLVED] Subscript out of range
Hey all,
I'm trying to set a cell of an array of booleans to true. But it gives me the subscript out or range error.
VB Code:
PassArr(lstFile.ListIndex) = True
(lstfile.listIndex = 0 - 43)
Is the code I'm trying to use to get the cell change to true.
and in the form load section I put this
VB Code:
ReDim Preserve PassArr(lstFile.ListCount)
(lstFile = 43)
So I'm not sure why it gives me this error. What is the problem?
Re: Subscript out of range
If lstFile has no selection then the lstFile.ListIndex will be -1 throwing the error 9 error.
1 Attachment(s)
Re: Subscript out of range
lstFile was selected and I debugged then put my cursor over lstFile to show it's value
Re: Subscript out of range
Ok, in that procedure with it in break mode, do a UBound(PassArr) in the immediate window and see what its dimensioned to.
Re: Subscript out of range
Ah! It was zero. I figured it out, I was dimensioning the array before setting the contents into the list box.
Thanks for helping Rob.
Re: [RESOLVED] Subscript out of range
No prob. :)
I thought it was something with the arr not being dimmed to the correct size. :D