VBA: Work with a Specific Part of an Array
Posted on 2007-10-07
I've converted an Excel range into a VBA array. Now, I'd like to work with specific data in the array--the equivalent of two columns at a time.
I can grab one value from the array (i.e. '1,1' for the first number), but I can't figure out how to work with a larger data set within the array
Here is my code for getting one value:
Dim myarray As Variant, ColumnsOneTwoAvg as Integer
myarray = Range("b1:g3").Value
ColumnsOneTwoAvg = WorksheetFunction.Average(myarray(1, 1)) ' something like (myarray(1:3,1:2)) ?
Thank you very much.