What I want to do is pull in specific values from a 3-dimensional array and then calculate the average of those values. Here is a snipet of my code:

Dim j As Integer, avgTempArray1 As Long, avgTempArray2 As Long, T1 As Long, T2 As Long, tempVal As Long
For AR = 1 To 19
    T2 = 0
    For i = 1 To numSelectedPrnts
        T1 = 0
        For j = 1 To x
            MsgBox ("ValueArray(j, AR, i) :" & ValueArray(j, AR, i))
            tempVal = ValueArray(j, AR, i)
            MsgBox ("tempVal :" & tempVal)
            T1 = T1 + tempVal
            Next j
        avgTempArray1 = T1 / j
        T2 = T2 + avgTempArray1
        Next i
    avgTempArray2 = T2 / i
    var1Yvals(AR) = avgTempArray2
    Next AR
When I use MsgBox to check the value of ValueArray(j, AR, i) it returns the proper value of 0.84623, so I know the array is holding the correct value. But once I pass that value to the variable called tempVal, the value of tempVal is 1. I cannot figure out what is going on here... is there some special way you need to get array values from a 3D array?