Hello friends,
I am facing an issue with my code, whenever i am trying to store any data by splitting a string, I am receiving script out of range error and error in nstr variable.
Can anyone fix this error for me.
Hello friends,
I am facing an issue with my code, whenever i am trying to store any data by splitting a string, I am receiving script out of range error and error in nstr variable.
Can anyone fix this error for me.
Sure i will help you you out with this before that can i get your code, with would be helpful for me to fix your issue.
Here is the code in which i ma getting the error.
Code:dim mstr() as string dim nstr() as string dim nstring as string mstr = Split(nstring, vbctrlf) For j = LBound(mstr) To UBound(mstr) If nstr(LBound(nstr)) = " " Then nstr(UBound(nstr) + 1) = mstr(j) Else For k = LBound(nstr) To UBound(nstr)
As i can see in the code is that you need to provide a size for the array variable nStr() which you have defined it as undimensioned and to dimension an array on the fly you use the redim statement.
Use Split() function in Str() array variable. The Split() function automatically dimensions and fills a string array. The lower bound is always 0 when you do this.
Bookmarks