Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Calculating Using Macro Pleaseeeeeeee
I have a workbook with multiple worksheet. For each worksheet in the Wkbook I
want the following to Calculate. First C162:M163 - Copy content and paste the content as Value Second For each cell C165:M252 Calculate (C18/c$162)*C$163, (d19/d$162)*d$163 and so on till (M161/m$162)*m$163 then for each cell C18:M161 Calculate (c18/c$162)*c$13, (d19/d$162)*d$13, and so on till (M161/m$162)*m$13. lastly add Cell C18:C161, D18:D161 until M18:M161 and clear content in C163:M163. - Note please the calculation is a sample calculation for C18 and d19. I want the calculation to affect all cells within range specified C18:M161 and C165:M252, that is why I made row c$162, rowC$13 and Row C$163 absolute. Please help me in any way possible, I really appreciate all support. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Calculating Using Macro Pleaseeeeeeee
Try the code below. I'm using formulas. You may want to copy the formulas
and use PasteSpecial values. I think there is a problem with clearing "C163:M163" because these values are used as part of the calculation for other cells. first try the code without the clearcontents to see if everything works. then decide if you need to paste values before clearing the cells. Range("C162:M163").Copy Range("C162:M163").PasteSpecial _ Paste:=xlPasteValues Range("C165").Formula = "=(C18/C$162)*C$163" Range("C165").Copy Destination:=Range("C165:M252") Range("C164").Formula = "=Sum(C18:C161)" Range("C164").Copy Destination:=Range("D164:M164") Range("C163:M163").ClearContents "Yossy" wrote: I have a workbook with multiple worksheet. For each worksheet in the Wkbook I want the following to Calculate. First C162:M163 - Copy content and paste the content as Value Second For each cell C165:M252 Calculate (C18/c$162)*C$163, (d19/d$162)*d$163 and so on till (M161/m$162)*m$163 then for each cell C18:M161 Calculate (c18/c$162)*c$13, (d19/d$162)*d$13, and so on till (M161/m$162)*m$13. lastly add Cell C18:C161, D18:D161 until M18:M161 and clear content in C163:M163. - Note please the calculation is a sample calculation for C18 and d19. I want the calculation to affect all cells within range specified C18:M161 and C165:M252, that is why I made row c$162, rowC$13 and Row C$163 absolute. Please help me in any way possible, I really appreciate all support. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculating Macro | Excel Discussion (Misc queries) | |||
Macro for calculating | Excel Discussion (Misc queries) | |||
Macro not calculating correctly | Excel Programming | |||
Macro calculating incorrectly.. what can cause this? | Excel Programming | |||
Calculating Commissions Macro | Excel Programming |