View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Is Excel Threadsafe

Without seeing any of your code, it's hard to tell where you might make
improvements. I can't see that cell by cell is more reliable than range by
range. Could you do range by range transfer of .value, instead of
copy/paste? For example:

Worksheets(1).Range("A1:D10").Value = Worksheets(2).Range("F21:I30").value

No clipboard required.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"snoopydoopy" wrote in message
...
On Apr 7, 8:35 pm, snoopydoopy wrote:
On Apr 7, 7:42 pm, JLatham <HelpFrom @ Jlathamsite.com.(removethis)
wrote:



It also makes me think that you're going to want to watch out for any
use of
ActiveWorkbook or ActiveSheet or any 'Active' object, and go with
'ThisWorkbook' during definition/assignment of objects and actions.


"snoopydoopy" wrote:
On Apr 7, 12:47 pm, snoopydoopy wrote:
Using C# and Office Interop, I am opening 2 different copies of a
workbook (I manually copy workbook1.xls to workbook2.xls).Both
workbook1 and workbook2 have exactly same copies of the macros.
From
the interop, I am calling macros in workbook1 and workbook2. I am
able to do this successfully but I am worried about 1 thing. At
different points in the macro, I call application.calculate and
then
reset it back to manual. My worry is that the calculation settings
in
one workbook would affect the processing of the other workbook.
Anybody can throw light on this?


I just realized that in the Macro, I am doing lot of copy paste. So
if there are multiple instances or excel running and each of them is
executing macros with lot of copy and paste commands then the result
is going to be very screwed up. So I need to write code which would
do cell by cell explicit copy.


Yeah, good point. I had taken care of part of it but need to remove
the selection portion for printing and stuff. I find it fascinating
that other people haven't felt the need to run things in parallel to
exploit the multiprocessor scenario. I know excel 2007 does threading
behind the scenes to speed up calculations but still I think there is
a definite need to run lot of calculations in parallel.


I had to change all the copy and paste commands to explicit cell by
cell assignment and this reduced the overall speed of my
calculations.