LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default More Information on Question


I was working on an excell automation task that had to copy data ranges.
Just make sure you get the data range in 1 range as an array and not
cell by cell. Pehaps this is very obvious but in my case the thing
worked 100 times faster if I got all the data of a row as an array in
stead of picking the cell data of that row cell by cell.

In C#

Application App = new Excel.ApplicationClass();
// Open Workbook ...
// Get Sheet ...
int RowIndex = 1;
// Get Row Range Object
Range ThisRow = (Excel.Range)ThisWorkSheet.Rows[RowIndex,
System.Reflection.Missing.Value];
// Get Array of data (2 dimensional Array, in this case 1 by [column
count], with VB style 1 based index)
Array RowData = (Array)ThisRow.Value;
// Loop over all Data
for (int ColIndex = 1; ColIndex <= RowData.Count; ColIndex++)
{
object CellData = RowData[ColIndex];
}
// This works MUCH faster then
for (int ColIndex = 1; ColIndex <= RowData.Count; ColIndex++)
{
object CellData = ((Excel.Range)ThisWorkSheet.Cells[ThisRow,
ColIndex]).Value
}



Microsoft Reference (in C++): Use MFC to Automate Excel and Obtain an
Array from a Range (url:
http://support.microsoft.com/default...b;EN-US;186122)



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save an Excel 97-2003 version or 2007 version for Mac 200 Bronigal Excel Discussion (Misc queries) 1 December 7th 09 08:04 AM
Speed and Excel Version Jeff Excel Discussion (Misc queries) 3 July 29th 07 03:56 PM
Recover earlier version of excel sheet after new version saved? stephanie38 Excel Discussion (Misc queries) 3 June 17th 05 03:52 AM
How can I update the version of Excel 2000 9.0 to version 10.0 Ramsey Can Excel Discussion (Misc queries) 1 May 11th 05 03:28 PM
Office automation application which will work with any version of office C#.NET Silly Programmer Excel Programming 1 February 21st 04 10:54 AM


All times are GMT +1. The time now is 12:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"