Search notes:

Excel: Fill a range fast with VBA

option explicit

sub main() ' {

  '
  ' Define a two dimensional array for
  ' 100 rows and 50 columns:
  '
    dim v(1 to 100, _
          1 to  50) as variant

    dim row_ as long
    dim col_ as long

  '
  ' Fill the array
  '
    for row_ = 1 to 100
    for col_ = 1 to  50
        v(row_, col_) =  35 +  (row_+3 mod 7) * (col_+4 mod 11)  mod 101
    next col_
    next row_

  '
  ' Assign the array to the range
  '
    range(cells(  2,  2),  _
          cells(101, 51))  = v

end sub ' }

See also

Same idea, but filling a range with PowerShell
Excel range

Index