Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write 3d array to 2d spreadsheet

Status
Not open for further replies.

FractalWalk

Technical User
Nov 18, 2002
141
US
I am using VBA in Excel to create a 3 dimensional array. I need to write the contents of that array to various sheets in a workbook.

I know I can write them field by field but that is a very slow process. With 2d arrays I just usually assign to a range like below:

Sheets(1).Range("A2:Z60000") = TestArray2d

But if I have a 3d array is there a way to do the same thing by using a range of spreadsheets. I know the following code may be nonsensical but hopefully it illustrates what I am trying to do:

Sheets(1:3).Range("A2:Z60000") = TestArray3d
 
You can slice the array into 2d arrays with VBA and add layer by layer to the workbook. It requires accessing all items in the source array, but doing this in VBA is faster than writing in single cells.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top