Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
gh gh is offline
external usenet poster
 
Posts: 1
Default Fast way to insert data from database

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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
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?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fast way to insert data from database

Just my $0.02...

I have recently begun copying the entire recordset to a blank workshee
and then stripping off everything I don't need. Using:

Range("A1").CopyFromRecordset objRS

You can delete the headers and other stuff and do formatting on a muc
larger scale (i.e. by column rather than by individual cell). Yo
could even set up a sheet with all of your formatting and then past
the recordset into it.



--
Message posted from http://www.ExcelForum.com

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
Need really fast method to sort data for my part numbering spread Chris Dundorf Excel Discussion (Misc queries) 7 March 24th 10 06:05 PM
Help finding a fast way to cross reference data between sheets??? Scott Excel Discussion (Misc queries) 1 August 18th 08 04:51 PM
database query not showing foxpro database How I import data mangat New Users to Excel 1 June 24th 07 03:31 PM
Bar Graph - Values from one cell, data from another FAST formating Rianne Excel Discussion (Misc queries) 1 March 10th 06 08:51 PM
fast way to make reports from a database 71marco71[_6_] Excel Programming 0 February 5th 04 09:15 PM


All times are GMT +1. The time now is 07:43 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"