Sub routine failure

  • Thread starter Thread starter Martin Stabb
  • Start date Start date
M

Martin Stabb

The following subroutine works fine in a blank sheet but
only the first line works in my calculation sheet in the
same workbook. Any ideas please?

Sub ResetDefaults()

Cells(12, 4).Formula = "=20"
Cells(15, 4).Formula = "=250"
Cells(21, 4).Formula = "=PI()*D20^2/4"
Cells(16, 12).Formula = "=D13/D14"
Cells(17, 12).Formula = "=D13/D21"

End Sub
 
Martin,

What happens when you run it, does it just not update the cells, or does it
error out?

By the way, the = is not needed in
Cells(12, 4).Formula = "=20"
it can be written as
Cells(12, 4).Formula = 20
or
Cells(12, 4).Value = 20

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks for your reply and coments.

As I suspected (eventually) the solution involved turning
off and on the automatic calculation with;

Application.Calculation = xlCalculationManual

and

Application.calculation = xlCalculationAutomatic

Regards

Martin
 
Back
Top