Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I suspect that is the way. Just to add, however,
In VBA it would be Range("A1:A10").Value = Application.Transpose(my1Darray) so perhaps you can figure out how to do that in C#. -- Regards, Tom Ogilvy "R.E." wrote in message ... Microsoft Support explains how to copy an array to a range in the Article (ID 306023) "How to transfer data to an Excel workbook by using Visual C# 2005 or Visual C# .NET": objRange = objSheet.get_Range("A2", m_objOpt); objRange = objRange.get_Resize(100,3); objRange.Value = objData; Although the last line should be: objRange.set_Value(Type.Missing, objData); When using a 1D array to transfer data, set_Value assumes the 1D array is a row of data, even if the range specifies a single column of cells: float[] aryFloats; objRange = objSheet.get_Range("A2", Type.Missing); objRange = objRange.get_Resize(aryFloats.Length, 1); objRange.set_Value(Type.Missing, aryFloats); How can I efficiently copy a large 1D array into a column of cells? Is there a more efficient way than copying the data from the 1D array into a 2D array? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
1-D arrays do not have a transpose.
P.S. Copying the data from the 1D array into a 2D array does work, but is adds efficiency due to the extra copy step. Using single-dimensioned, zero-based arrays is recommended for best performance in general. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
< smile
-- Regards, Tom Ogilvy "R.E." wrote in message ... 1-D arrays do not have a transpose. P.S. Copying the data from the 1D array into a 2D array does work, but is adds efficiency due to the extra copy step. Using single-dimensioned, zero-based arrays is recommended for best performance in general. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy & Paste code more efficient | Excel Programming | |||
Efficient Array Formula Construction | Excel Discussion (Misc queries) | |||
Efficient Code | Excel Programming | |||
More Efficient code than this | Excel Programming | |||
More efficient code | Excel Programming |