Re: Slow Macros in Excel 2007
- From: "gimme_this_gimme_that@xxxxxxxxx" <gimme_this_gimme_that@xxxxxxxxx>
- Date: Mon, 11 Jun 2007 13:11:41 -0700
Hi Charles,
The concept of using an array or an array of arrays applies went you
need to iterate through a result set and insert all the data into a
Work*** using a *SINGLE* VBA instruction. You have an Array of rows
and each row has an array of data. This would be an alternative to
executing a VBA instruction for each iteration or row .)
Using Applescript with Excel, for example, with the example I posted,
you can do it.
In Applescript you have a list, and each element of the list is
another list with row data.
AppleScript lists translate into Arrays in VBA - but not always.
The topic came up because I explained how in optimizing Excel it's
faster to insert data a row at a time instead of a cell at a time.
Jon, suggested doing it even faster, going for an nxm matrix at a
time.
I asked him to show me.
He posed an example where data was copied from one Work*** to
another matrix at a time.
Which is fine. But as an example it's useless for improving the
preformance of SQL processing.
His example assumes data already exists in a Work*** and isn't
applicable to cases where one iterates through a result set and then
inserts the data into VBA with a single instruction.
Essentially it was a.Range("A1:D4").value = b.Range("A1:D4").value
where a and b are different sheets.
It may be possible. It might be possible to create a string, delimite
cells with tabs and rows with semi colons.
Something like this ..
Constant CELL_DELIMITER = chr(?) ' I don't know the value of ?
Constant ROW_DELIMITER = chr(?) ' I don't know the value of ?
'Then
Dim a as String
a = "1" + CELL_DELIMITER + "20" + ROW_DELIMITER
a = a + "30" + CELL_DELIMITER + "11" + ROW_DELIMITER
Range("A1:B2").value = a
' puts 1 in A1, 20 in A2, 30 in A2, and 11 in B2 not a in each of the
four cells
There would be a trade off with building a gigantic string and in
inserting the data with a single instruction.
It may turn out that nxm wouldn't be faster. But we can't even get nxm
going.
What does an Array() function have to do with reading/writing a database?
Charles
______________________
Decision Models
FastExcel 2.3 now available
Name Manager 4.0 now availablewww.DecisionModels.com
.
- Follow-Ups:
- Re: Slow Macros in Excel 2007
- From: Charles Williams
- Re: Slow Macros in Excel 2007
- From: Ken
- Re: Slow Macros in Excel 2007
- References:
- Slow Macros in Excel 2007
- From: Ken
- Re: Slow Macros in Excel 2007
- From: Jim Cone
- Re: Slow Macros in Excel 2007
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Slow Macros in Excel 2007
- From: Jon Peltier
- Re: Slow Macros in Excel 2007
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Slow Macros in Excel 2007
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Slow Macros in Excel 2007
- From: Jon Peltier
- Re: Slow Macros in Excel 2007
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Slow Macros in Excel 2007
- From: Charles Williams
- Slow Macros in Excel 2007
- Prev by Date: Re: find count of multiple excel instances
- Next by Date: Re: UserForm In Range Out of Range
- Previous by thread: Re: Slow Macros in Excel 2007
- Next by thread: Re: Slow Macros in Excel 2007
- Index(es):