Re: Code Efficiency Suggestions
- From: "Nick Hebb" <n.hebb@xxxxxxxxxxx>
- Date: 8 Jun 2005 23:48:31 -0700
Another option would be to process the data in the background, storing
it in a bunch of text files (65k rows/file), then import each text file
into a new sheet using QueryTables. The pseudo code is as follows:
Create new folder
Outer loop: while not EOF of input file
create new output file in the new folder
write field headers to output file
output file row counter = 0
Inner loop: while output file row counter <65000 and not input EOF
read line
transform contents of line
write line to output file in csv format (NO SPACE after comma)
increment output file row counter
End inner loop
End outer loop
For each file in new folder
Select worksheet
Import data from text file using ActiveSheet.QueryTables
Next
Delete files and new folder
I would think that this would much faster since you are pre-processing
the data without having to interface with the spreadsheet and the Excel
object hierarchy. QueryTables is very fast and works on formatted text
files just as well as it does on databases.
Try recording a macro while doing Data > Import External Data > Import
Data. This will prompt you for a data source. Navigate to the text
file like you're opening a file, and follow the importing wizard.
.
- Follow-Ups:
- Re: Code Efficiency Suggestions
- From: Job
- Re: Code Efficiency Suggestions
- From: TonT
- Re: Code Efficiency Suggestions
- Prev by Date: Re: Can I create a macro to identify and delete blank rows in a range?
- Next by Date: Re: Protect sheets
- Previous by thread: How do I alternate a sort from a text box via macros?
- Next by thread: Re: Code Efficiency Suggestions
- Index(es):
Relevant Pages
|