ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Array to Worksheets (https://www.excelbanter.com/excel-programming/356226-array-worksheets.html)

Paul W Smith[_4_]

Array to Worksheets
 
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



Tom Ogilvy

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




[email protected]

Array to Worksheets
 
Nothing I want to mark this thread. Thanks guys.



All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com