-
Solved: Looping through a two dimensional array, displaying element values, having problems
What i am trying to do is loop through a two dimensional array that takes values from their respective cell locations and then display them one at a time in a message box. This simple code works fine until the last iteration is executed. After the last iteration it says that i have "a type mismatch error". any help would be greatly appreciated.
-----here is the code-------
[VBA]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[/VBA]
Last edited by Aussiebear; 01-19-2013 at 03:40 PM.
Reason: Added the correct tags to the supplied code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules