View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Array to Worksheets

I am think of the opposite of :

Array = Range("A1").CurrentRegion


exactly:
For a 2D array:

rw = Ubound(array,1) - lbound(array,1) + 1
col = Ubound(array,2) - lbound(array,2) + 1
range("A1").Resize(rw,col).Value = array

if it is a 1D array

col = Ubound(array,1) - lbound(array,1) + 1
Range("A1").Resize(1,col).Value = Array

or to put it horizontal

rw = Ubound(array,1) - lbound(array,1) + 1
Range("A1").Resize(rw,1).Value = Application.Transpose(Array)

In xl2000 and earlier, use of transpose restrict the number of array
elements to 5461.

--
Regards,
Tom Ogilvy



"Paul W Smith" wrote:

Is there a quick way of outputting the contents of an array to a worksheet
without having to iterate through all the rows and columns?

I am think of the opposite of :

Array = Range("A1").CurrentRegion