Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Excel worksheet in VBA 2

Status
Not open for further replies.

CautionMP

Programmer
Dec 11, 2001
1,516
US
Long story short, I create a report in Microsoft Excel by using OLE automation to move data from Microsoft Access to a blank worksheet using a Row/Column loop.

Now here's the question: From a speed & file size perspective is it quicker (with automation) to apply Cell formatting:[ol]
[li]One Cell at a time?[/li]
[li]Or to a Range of Cells?[/li][/ol]

I would build test routines and monitor time/size but as usual the difference between 'done' and 'done right' is a paycheck.

Thanks in advance for any input,
CMP


[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
using a Row/Column loop
Have you tried the CopyFromRecordset method of the Range object ?
apply Cell formatting
to a Range

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




I was just about to make PHV's first point. One swell foop with the CopyFromRecordset method.

Skip,

[glasses] [red][/red]
[tongue]
 
Well I'll be dipped in pooh.

I've seen both of you mention [tt]CopyFromRecordset[/tt] on numerous occasions. Being from the 'if it ain't broke don't fix it' crowd I never really tried it.

Based on the following, I'm a convert.

Table with 238 fields and 2,824 records. Two identical routines (well you know what I mean) in Access that create a new workbook and dump all the records to the first sheet without any formatting:
[ul][li]Row/Column loop, Time 0:10:27[/li]
[li][tt]CopyFromRecordset[/tt], Time 0:00:17[/li][/ul]

With [tt]CopyFromRecordset[/tt] I will have to apply the formatting to a range so I guess my original question just became moot.

Thank You Gentlemen,
CMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top