Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Sort and summarize code help request

All,

I have the code below:

What I want to be able to do is for all the worksheet names in the
workbook that begin with 'DATA' is to summarize the data in column A
and B, and the output it in the output sheet.

For example the kind of data I have is:

Worksheet name = DATA010209

CODE VALUE
XXX 1
XXX 22
XXX 21
XXX 45
BBB 64
NNN 54
AAA 64

Worksheet name = DATA040209

CODE VALUE

NNN 54
AAA 64

Using VBA how can I add up all the codes and produce an output
total in a worksheet labelled 'output'?

For example in this case the worksheet 'output' would display

DATA010209

XXX 89
BBB 64
NNN 54
AAA 64

DATA040209

NNN 54
AAA 64

The code I have is as follows:

Sub SummarizeData()



For Each mySh In Worksheets

If Left(mySh.Name, 5) = "DATA " Then

With Sheets("Data")
LastRow = Sheets("Data").Range("A" & Rows.Count).End(xlUp).Row
Set CodeRange = .Range("A2:A" & LastRow)
Set SumRange = .Range("B2:B" & LastRow)
End With
Set CriteriaRange = Sheets("Output").Range("A2")

Total = WorksheetFunction.SumIf(CodeRange, CriteriaRange, SumRange)
Sheets("Output").Range("B2") = Total



End Sub


Thanks in advance for your help,

Regards

Joe Crabtree
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Sort and summarize code help request

Hello Joe,

I suggest to use my UDF Sfreq:
http://www.sulprobil.com/html/sfreq.html

Regards,
Bernd
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
Extract Date, and summarize data request joecrabtree Excel Programming 1 December 19th 08 12:35 PM
Request for a code FARAZ QURESHI Excel Discussion (Misc queries) 0 January 27th 08 02:59 PM
sort doesn't sort numerically 2nd request Janis Excel Programming 4 September 12th 06 05:57 PM
PLEASE HELP ! SORT & SUMMARIZE ? travelersway New Users to Excel 6 July 25th 05 03:10 PM
Macro or VB Code to Summarize Info.from 4 workbooks Help Me Rhonda TOA[_2_] Excel Programming 1 October 9th 04 01:52 PM


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