mcpeekj
Vendor
- Sep 21, 2001
- 105
I'm trying to loop through an array and create another array with only the rows where a phrase exists. gmmastros was kind enough to help me with the instr to do the search, and it works great when I'm doing anything but trying to create and populate another array. Here's the code.
I'm declaring alldata_sub() because I get a type mismatch when I leave the parentheses off. The error I'm getting with the above code is:
Microsoft VBScript runtime error '800a0009'
Subscript out of range
Help?
Code:
dim alldata_sub()
FOR rowcounter= 0 TO alldatarows
id=alldata(0,rowcounter)
lastsent=alldata(1,rowcounter)
subject=alldata(2,rowcounter)
posts=alldata(3,rowcounter)
for j = 0 to alldatarows
if (InStr(1, alldata(2,j), "Automated Failed", vbTextCompare) > 0) Then
'ReDim preserve alldata_sub(count)
alldata_sub(0,count) = alldata(1,j)
alldata_sub(1,count) = alldata(3,j)
count = count + 1
exit for
end if
next
next
I'm declaring alldata_sub() because I get a type mismatch when I leave the parentheses off. The error I'm getting with the above code is:
Microsoft VBScript runtime error '800a0009'
Subscript out of range
Help?