View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Fast way to insert data from database

gh

How many records/columns? Try turning off screen updating and setting
calculation to manual.

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

'your code

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

Also, it may be faster to transfer the whole recordset to the worksheet,
then apply the formatting afterwards.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"gh" wrote in message
...
I wrote a VB program that retrive data from SQL server to make a excel
report. The report has some static text, such as report header, report
footer, etc. Besides I need to set the font size of certains columns,
therefore, I cannot directly use the ADO recordset directly.

To make the excel report, I need to add the data cell by cell using
WorkSheet.Cells() method, it works but its performance is slow.

Is there any way for me to inserting the data from database with good
performace?