Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
minaz_khan
 
Posts: n/a
Default 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
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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Excel 2003 Gets Slow moba00 Excel Discussion (Misc queries) 0 April 15th 05 02:11 PM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 11:32 AM
Why is the subtotal function in excel 2003 very slow compared to . wd1 Excel Worksheet Functions 0 January 10th 05 01:23 AM
Slow opening Excel Workbook with over 50 Worksheets KathyRice Excel Discussion (Misc queries) 1 January 4th 05 11:49 PM


All times are GMT +1. The time now is 11:32 AM.

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

About Us

"It's about Microsoft Excel"