I need help with this vba hand written macro. i am trying to loop through a two dimensional array with elements that takes values from their respected cell locations. I want to iterate through all the array elements and assign each element a value that is a number within the excel cell location and message the wale. it works fine until the last iteration is completed. once the last iteration is completed it says, “type 13 error type mismatch” any help would be greatly appreciated.
thanks in advance!
—code—-
Sub arrayfun()
Dim arraytest(1 To 5, 1 To 2) As Double
For j = LBound(arraytest) To UBound(arraytest)
For i = LBound(arraytest) To UBound(arraytest)
arraytest(i, j) = ThisWorkbook.Sheets(“sheet1”).Cells(i, j).Value
MsgBox (arraytest(i, j))
Next
Next
End Sub