Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sub routine failure

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sub routine failure

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)

"Martin Stabb" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sub routine failure

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
-----Original Message-----
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)

"Martin Stabb"

wrote in message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sub routine Gord Dibben Excel Discussion (Misc queries) 0 November 13th 09 12:15 AM
vlookup failure & ctrl-f failure? joemeshuggah Excel Discussion (Misc queries) 4 December 22nd 08 07:22 PM
SUB ROUTINE tokirk Excel Programming 1 January 19th 04 02:17 AM
Routine?? Zax Excel Programming 3 December 19th 03 05:50 PM
Need VBA Routine John M. Lembo Excel Programming 0 July 13th 03 01:51 AM


All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"