Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Writing to excel is very slow
I am writing a code in VB.NET and writing to it through a dataset. But for every 25 seconds it writes only 100 rows to the excel. Can any1 please comment on this. Here is a piece of the code For Each drXML As DataRowView In ViewToSort rowCnt += 1 totCnt += 1 If rowCnt = 1 Then objExcelWS = objExcelWB.Worksheets(sheetCnt) For colCnt = 1 To xlsDS.Tables(0).Columns.Count objExcelWS.Cells(rowCnt, colCnt) = xlsDS.Tables(0).Columns(colCnt - 1).ColumnName Next End If For colCnt = 1 To xlsDS.Tables(0).Columns.Count 'objExcelWS.Cells(rowCnt + 1, colCnt) = "'" & Format(drXML(colCnt - 1).ToString()) objExcelWS.Cells(rowCnt + 1, colCnt) = drXML(colCnt - 1).ToString() Next 'if row count reaches 65K and not end of dataset, close this worksheet If rowCnt = 65000 And totCnt < xlsDS.Tables(0).Rows.Count Then rowCnt = 0 sheetCnt += 1 End If Next -- minaz_khan ------------------------------------------------------------------------ minaz_khan's Profile: http://www.excelforum.com/member.php...o&userid=25875 View this thread: http://www.excelforum.com/showthread...hreadid=392591 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
Excel 2003 Gets Slow | Excel Discussion (Misc queries) | |||
Difference in number of Excel NewsGroups | Excel Discussion (Misc queries) | |||
Why is the subtotal function in excel 2003 very slow compared to . | Excel Worksheet Functions | |||
Slow opening Excel Workbook with over 50 Worksheets | Excel Discussion (Misc queries) |