Here're a few examples to show how it works:
How to read cell values from a worksheet into an array
The array receiving the cell values must be declared with data type
Variantand without presetting the size!
The row index and the column index of the resulting array always begin with 1, no matter if and how
Option Baseis set.
If you read from a range that doesn't start in cell A1, the row and column index of the array still begin with 1, they don't match the real row and column number of the according cells.
If your array for instance contains the cell values from range "C4:F7", then you can convert your array indexes to cell row/column numbers as follows:
How to write the array back to a worksheet
As you can see, the array containing the values doesn't have to be of data type
Variant, it can also be another data type. But usually it is, because in most cases, you'll read the values from the worksheet first (and then it must be
Variant) and write them back to the worksheet after the changes to the value are done.
Last, but not least, an example to show the differences in how long it takes to work with each cell individually as opposed to using an array. (This example uses 100.000 cells.)
For detailed info about working with arrays look here.