cerruti1881
Technical User
I wrote the following testing code:
The above script gives error:
Microsoft VBScript runtime error: Subscript out of range
Anyone knows how to assign value of array 1 to array 2 if conditions are met?
Code:
Dim array1(6)
Dim array2()
array1(0) = "a"
array1(1) = "b"
array1(3) = ""
array1(4) = "c"
array1(5) = ""
array1(6) = "d"
For i = 0 to 6
If array1(i) <> "" Then
array2(i)= array1(i)
End If
Next
For i = 0 to Ubound(array2)
If array2(i) <> "" Then
Wscript.Echo array2(i)
End If
Next
The above script gives error:
Microsoft VBScript runtime error: Subscript out of range
Anyone knows how to assign value of array 1 to array 2 if conditions are met?