Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum up values in each column in 12 different worksheets and displayvalue in a MsgBox

Hi,

Can anyone help me on how to sum up numerical values in each column
(say Column C) in 12 different worksheets and display value in a
MsgBox.

Because I'm quiet new to VBA I'm stuck...please help...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum up values in each column in 12 different worksheets and displayvalue in a MsgBox


Here are two methods. Te method to use depends on the number of sheets
in the workbook you want included and the number of sheets you want to
exclude from the total.

MyTotal = 0
for each sht in sheets
if sht.name < "Summary" and sht.name < "Cover Sheet" then
with sht
Lastrow = .Range("C" & rows.count).end(xlup).row
Set MyRange = .Range("1:" & LastRow)
Total = Total + worksheetfunction.sum(Myrange)
end with
end if
next sht
msgbox("the total is : " & Mytotal)



shtNames = array("sheet1","sheet3",sheet5")
MyTotal = 0
for each sht in shtnames
with sheets(sht.name)
Lastrow = .Range("C" & rows.count).end(xlup).row
Set MyRange = .Range("1:" & LastRow)
Total = Total + worksheetfunction.sum(Myrange)
end with
next sht
msgbox("the total is : " & Mytotal)


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=179907

Microsoft Office Help

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
link values from same cell of 20 worksheets into column on one she Stingraynut Excel Worksheet Functions 3 November 19th 09 05:40 AM
msgBox sum values Claudio Silva Excel Discussion (Misc queries) 1 January 18th 07 12:38 PM
Create worksheets for each matching values in Column? Kobayashi[_35_] Excel Programming 7 June 2nd 04 07:10 AM
Create Worksheets Based Upon Changing Column Values in XP Gary[_12_] Excel Programming 1 December 18th 03 12:07 AM
Dividing data into worksheets by column values mikeb1 Excel Programming 2 December 12th 03 04:40 PM


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