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

Hi,
I have this code below for every month(24 total) where the same variables
are used...every sub calls the other one. When I go through the steps one by
one via the "F8" button it calculates correctly but when I run it or press
"F5" incorrect values are calculated?
Any help ?

Thanks alot,
Ozgur

For i = 4 To 500
If Range("A" & i) = "" Then
Exit For
Else
TMC_BEG_INV_QTY = Cells(i, 3).Value
TMC_BEG_INV_AMT = Cells(i, 4).Value
TMC_PURCHASE_QTY = Cells(i, 5).Value
TMC_PURCHASE_AMT = Cells(i, 6).Value
TMC_USAGE_QTY = Cells(i, 8).Value
If (TMC_BEG_INV_QTY + TMC_PURCHASE_QTY) = 0 Then
TMC_USAGE_AMT = 0
TMC_USAGE_MAC = 0
Cells(i, 9) = TMC_USAGE_AMT
Cells(i, 7) = TMC_USAGE_MAC
Else
TMC_USAGE_AMT = (TMC_BEG_INV_AMT + TMC_PURCHASE_AMT) /
(TMC_BEG_INV_QTY + TMC_PURCHASE_QTY) * TMC_USAGE_QTY
Cells(i, 9) = TMC_USAGE_AMT
TMC_USAGE_MAC = (TMC_BEG_INV_AMT + TMC_PURCHASE_AMT) /
(TMC_BEG_INV_QTY + TMC_PURCHASE_QTY)
Cells(i, 7) = TMC_USAGE_MAC
End If
End If
Next
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
sum/autosum not calculating correctly websterk12 Excel Worksheet Functions 6 June 24th 09 10:39 PM
Formulas Not Calculating Correctly Daren Excel Worksheet Functions 8 November 27th 07 09:37 PM
formula not calculating correctly CH Excel Discussion (Misc queries) 2 September 24th 07 06:06 AM
Formulas not calculating correctly MWickline Excel Discussion (Misc queries) 3 June 9th 05 04:10 PM
Total Row Not Calculating Correctly Jamie Excel Programming 2 February 4th 05 05:47 PM


All times are GMT +1. The time now is 08:00 PM.

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"