why cell.Formula is so slow?

juliodepalma

New Member
Joined
Sep 4, 2002
Messages
6
Hi all,

In a VBA macro I'm writting I need to go through every cell in a range (that contains a formula), and substitute some part of the them if certain criteria is met.

I've realised that writting the formula as: "theCell.Formula = strNewFormula" is unbearable slow. In my example nearly 85 s. for processing 81 cells. Incidentally, if instead of setting the formula, I write it as a range comment, it tooks only 0,75 s.

Is there a way to speed this operation?
Any idea?

Thanks in advance

-- Julio Garcia

PS: At the begining of the code I've disabled the automatic calculation (as usual):
ActiveSheet.EnableCalculation = False
Application.Calculation = xlCalculationManual
ActiveWorkbook.UpdateRemoteReferences = False
 
Hi,

Right Pablo, the function may change the value of "strResultado" directly. I tried to pass by reference "celda.Formula" to the function in order to avoid reasigning, but it didn't let me, the compiler raised an error.

I didn't send the excel book to Mark or anyone (as he suggested), because without the referenced books it won't work and they are huge. But if this helps...

Thanks,

-- Julio Garcia
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top