View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Quietman Quietman is offline
external usenet poster
 
Posts: 109
Default Speeding up execution of a Macro

I'm running a macro that pull data from excel file #1 to Excel File #2

The Macro is in excel file #2
it uses the sumif and offset formulas in combination with a ranged name
linked to excel file #1 (there are 43 worksheets of informatiuon in this
file, I need from 19 of these worksheets)

Formula: [DataArray = range referrenced in Excel file #1, changes based on
column in excel file #2]
ActiveCell.FormulaR1C1 = _
"=SUMIF(" & DataArray & ",RC1,OFFSET(" & DataArray & ",0,R1C,ROWS(" &
DataArray & "),1))"

Excel file #2 has 228 column of data and 1000 rows
I use a nested For Next loop to go through the full range and add the
correct formula to each cell. the copy the full range of data then paste
value it before turning back on calculations.

This works fine but I have to do this for five sheet in the woorbook, and
after running the macro excel becomes slow and slower

does any on have a better way of doinmg this that would be faster?

Thanks
--
Helping Is always a good thing