Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro =sum function not working correctly


Hi again,
so I have recorded a macro where there are two cells being adde
together and divided by another cell value. This worked fine on several
pages of the work book but now as I move through the book it is giving
false results.
Is there a problem with what was recorded?
I have listed below and what I want the formula to do is add E+F an
then divide by G and run through a column doing the same thing.
What seems to be happening with the current macro is that it is gettin
stuck and is then returning the result for the first cell in the
column.
Any help welcome
Patrick

Range("P6").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-11],RC[-10])/RC[-9]"
Range("P6:P45").Select
Selection.NumberFormat = "0.00


--
crowdx42
------------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...o&userid=37749
View this thread: http://www.excelforum.com/showthread...hreadid=573513

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro =sum function not working correctly

Let's put the formula in P5 and then copy P5 from P6 tthru P45:

Sub gsnu()
Range("P5").Formula = "=(E5+F5)/G5"
Range("P5").Copy Range("P6:P45")
Range("P6:P45").NumberFormat = "0.00"
End Sub
--
Gary's Student


"crowdx42" wrote:


Hi again,
so I have recorded a macro where there are two cells being added
together and divided by another cell value. This worked fine on several
pages of the work book but now as I move through the book it is giving
false results.
Is there a problem with what was recorded?
I have listed below and what I want the formula to do is add E+F and
then divide by G and run through a column doing the same thing.
What seems to be happening with the current macro is that it is getting
stuck and is then returning the result for the first cell in the
column.
Any help welcome
Patrick

Range("P6").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-11],RC[-10])/RC[-9]"
Range("P6:P45").Select
Selection.NumberFormat = "0.00"


--
crowdx42
------------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...o&userid=37749
View this thread: http://www.excelforum.com/showthread...hreadid=573513


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro =sum function not working correctly


I get the same result, the formula changes down the column BUT th
result shows identical for each cell in the column. A way I have foun
that does get it to give the correct answer is to select the cell an
then select and it then gives me the correct answer (this only work
with my original formula and not with the suggested formula)
Any ideas?
Patric

--
crowdx4
-----------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...fo&userid=3774
View this thread: http://www.excelforum.com/showthread.php?threadid=57351

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Macro =sum function not working correctly

GS code works fine for me.

How about your Calculation Mode in ToolsOptionsCalculation?

Auto or manual?


Gord Dibben MS Excel MVP

On Sun, 20 Aug 2006 13:41:38 -0400, crowdx42
wrote:


I get the same result, the formula changes down the column BUT the
result shows identical for each cell in the column. A way I have found
that does get it to give the correct answer is to select the cell and
then select and it then gives me the correct answer (this only works
with my original formula and not with the suggested formula)
Any ideas?
Patrick


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro =sum function not working correctly


It is set as Manual and recalculate before save.
Thanks for the help
Patrick


--
crowdx42
------------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...o&userid=37749
View this thread: http://www.excelforum.com/showthread...hreadid=573513



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro =sum function not working correctly


Well nearing completion of this project I found the same thing is
happening on another sheet when I excecute the same type of macro. This
time I am doing a VLoopUP of a name on another sheet and then pulling a
calculation on that sheet into the current sheet.
I get the exact same problem and the same workaround works here also.
Is this a bug in the code??
Patrick


--
crowdx42
------------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...o&userid=37749
View this thread: http://www.excelforum.com/showthread...hreadid=573513

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
If function not working correctly Relle Excel Discussion (Misc queries) 10 September 16th 09 10:42 AM
Offset function not working correctly Flipper Excel Discussion (Misc queries) 1 August 19th 09 06:45 PM
Subtotal function is not working correctly Bryan Excel Discussion (Misc queries) 0 November 21st 06 05:09 PM
Lookup function still not working correctly Mike K Excel Worksheet Functions 6 August 1st 05 02:22 AM
Function not working correctly Todd Huttenstine[_3_] Excel Programming 1 April 29th 04 02:33 PM


All times are GMT +1. The time now is 12:55 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"