Q:

Same array size, but subscript out of range

2 arrays (sheet1TempArray and sheet2TempArray) are declared and populated, both are of the same size 102. All arrarys shown in the code below are declared such as public sheet1TempArray(), sheet2TempArray() as String.
I want to check if the elements in sheet1TempArray is in sheet2TempArray, therefore i have the follow function. 
Function IsInArray(stringToBeFound As String, arr As Variant) As Boolean

     IsInArray = Not IsError(Application.Match(stringToBeFound, arr, 0))

End Function

And i have another sub which calls this function
For c = 1 To Application.CountA(sheet2TempArray)
        If IsInArray(Trim(CStr(sheet2TempArray(c))), sheet1TempArray) = False Then

           tempNotFoundArray(c) = CStr(sheet2TempArray(c))
        End If

    Next c

however, it kept on showing this error (sheet2TempArray(c)) = . May i ask is my looping method wrong? 

A:

I have found the problem which i should have realized earlier. 
For c = 1 To (Application.CountA(sheet2TempArray)-1)

Include -1 at the for loop will solve the problem. 

