ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dumping multi demensioned array into excel (https://www.excelbanter.com/excel-programming/290042-dumping-multi-demensioned-array-into-excel.html)

ExcelMonkey[_62_]

Dumping multi demensioned array into excel
 
I had a 2D VBA Array "Array1" that had the same dimensions as a named
excel range "PasteCell1". When I wanted to dump the data from VBA to
Excel I did the following:

Range("PasteCell1") = Array1

This worked becuase both were two dimensions and dimensioned 13X9.

However the VBA array has been expanded to 5 dimensions.

Array1(1 to 13, 1 to 9, 1 to 8760, 1 to 10, 1 to 3)

The first and second dimesions are still the same as my named range
(i.e. 13X9). Now that I have the extra dimensions I am assuming that I
either have to use a loop t fill the excel range or is there a way to
make the excel range equal to the VBA array by qualifying that I want
the first element of dimesions 3, 4 and 5. Can this be done?


---
Message posted from http://www.ExcelForum.com/


KJTFS[_85_]

Dumping multi demensioned array into excel
 
I think you will need to use a looping scheme for this. I doubt excel
would be able to figure out what cells you wanted to put in there.
Your array has a completely different structure now, there is no
specific values for those early indexes they are only memory locations.
In a five dimension array there is no such thing as array(X,Y).

Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/


Alan Beban[_4_]

Dumping multi demensioned array into excel
 
I believe that in 2003 Harlan Grove posted a general resizing procedure,
aresize, that might be of interest. Once you find the function, I
believe that

aresize Array1, , ,0, 0, 0
Range("PasteCell1").Value = Array1

should give you your desired result.

Alan Beban

ExcelMonkey < wrote:
I had a 2D VBA Array "Array1" that had the same dimensions as a named
excel range "PasteCell1". When I wanted to dump the data from VBA to
Excel I did the following:

Range("PasteCell1") = Array1

This worked becuase both were two dimensions and dimensioned 13X9.

However the VBA array has been expanded to 5 dimensions.

Array1(1 to 13, 1 to 9, 1 to 8760, 1 to 10, 1 to 3)

The first and second dimesions are still the same as my named range
(i.e. 13X9). Now that I have the extra dimensions I am assuming that I
either have to use a loop t fill the excel range or is there a way to
make the excel range equal to the VBA array by qualifying that I want
the first element of dimesions 3, 4 and 5. Can this be done?


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 10:37 AM.

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