Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
Calculating Macro Rosemarie Excel Discussion (Misc queries) 0 July 19th 09 10:32 PM
Macro for calculating DD Excel Discussion (Misc queries) 3 August 30th 07 06:44 PM
Macro not calculating correctly Ozgur Pars[_2_] Excel Programming 0 July 17th 06 03:53 PM
Macro calculating incorrectly.. what can cause this? Celt[_49_] Excel Programming 9 April 8th 06 04:42 PM
Calculating Commissions Macro Richard[_14_] Excel Programming 0 July 29th 03 11:40 PM


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