MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Generating an array of consecutive integers


Posted by Somkiat on January 01, 2002 7:54 PM

Are there any other formulas that can generate an array of consecutive integers?

Following formulas work fine but they could not extend beyond 65536 which is the last row.

{=Row(1:12)}
{=Row(Indirect("1:12"))
{=Row(Indirect("1:65536"))}

Thanks,
Somkiat


Posted by Jacob on January 01, 2002 8:09 PM

Hi

How many consecutive integers do you need?
Lets say 1,000,000 modify as needed.

Sub FillMyArray()

Dim MyArray(999,999)
'Arrays go from 0-whatever

for x = 1 to 1,000,000

MyArray(x-1)=x

next x

end sub

Jacob

Posted by Somkiat on January 02, 2002 2:17 AM

Thank you ... How about formula!!

Are there any other formulas?
I do not need either VBA subroutines or VBA functions.