Reputation: 45666
I tried the following : (VB.Net code)
Dim data As Object
Dim range As Excel.Range
range = WB.Sheets("mysheet").Range("A1:C5")
data = range.Value ' Here WB is the Wrokbook object
' Until here its working fine.
' During Debug: I can see data with values for [ (0,0), (0,1), (0,2), (1,0), .. ]
' Now following line gives an exception !!
Dim val = data(0,0) ' Index out of range exception.
How can I iterate the so called RangeValueDataType
object like an array ?
Reference: http://msdn.microsoft.com/en-us/library/bb238606(v=office.12).aspx
Upvotes: 0
Views: 284
Reputation: 35227
AFIAK Excel Range data is array with 1 base index, i.e. first item will be data(1, 1)
.
Upvotes: 1