ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calc mode question (https://www.excelbanter.com/excel-programming/338791-calc-mode-question.html)

Gary Keramidas[_2_]

calc mode question
 
i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary




Charles Williams

calc mode question
 
build the formulae as strings and then put them into the cells using
..formula

Charles
______________________
Decision Models
FastExcel 2.1 now available
www.DecisionModels.com

"Gary Keramidas" wrote in message
...
i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary






RonaldF

calc mode question
 
Application.ScreenUpdating = False

<vba code

Application.ScreenUpdating = True 'Don't forget to put it on!!!

--
Ronald Ferdinandus
http://www.ro-pay.nl


"Gary Keramidas" wrote:

i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary





Gary Keramidas[_2_]

calc mode question
 
thanks, doing that cuts it from 30 some seconds to about 6 seconds. i
haven't tried it on the clients slow machine yet, but it took over 3 minutes
the original way.

thanks again

--


Gary


"Charles Williams" wrote in message
...
build the formulae as strings and then put them into the cells using
.formula

Charles
______________________
Decision Models
FastExcel 2.1 now available
www.DecisionModels.com

"Gary Keramidas" wrote in message
...
i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary








Gary Keramidas[_2_]

calc mode question
 
just ran it on my client's pc, took 30 seconds instead of 3 and a half
minutes.

thanks again

--


Gary


"Charles Williams" wrote in message
...
build the formulae as strings and then put them into the cells using
.formula

Charles
______________________
Decision Models
FastExcel 2.1 now available
www.DecisionModels.com

"Gary Keramidas" wrote in message
...
i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary








Gary Keramidas[_2_]

calc mode question
 
had that, just turned it off to see the calcs

--


Gary


"RonaldF" wrote in message
...
Application.ScreenUpdating = False

<vba code

Application.ScreenUpdating = True 'Don't forget to put it on!!!

--
Ronald Ferdinandus
http://www.ro-pay.nl


"Gary Keramidas" wrote:

i have this code that loops as it build a formula

Application.Calculation = xlCalculationManual

for i = 1 to 10
Range("B4").Formula = Range("B4").Formula & "+'" & fPath & FileName$(i) &
"Trans'!$F4"
Range("C4").Formula = Range("C4").Formula & "+'" & fPath & FileName$(i) &
"Hours'!$F4"
next i

if i turn on screen updating, i can see each cell being calculated as it
builds the formula.

any way to turn of calculations so the cells aren't updated as they're
built?


--


Gary








All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com