Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Largest sum of two values in wksht collection

Can someone offer help with code that will programmaticaly loop thru a
worksheet collection in a workbook, determine the largest sum of two
cells within a monthly range, and summarize those results in a summary
worksheet? The following is provided in the hope it clarifies what I
am trying to achieve.

Situation:
A workbook contains 116 data worksheets each of which are identical
except for the values of their cells. Worksheet names are determined
by value of cell A1 in each respective worksheet (format "000"). A
simplified example of the first worksheeet named "001" is as follows:

A B C D E ... G
1 001
2 1/1/04 Olgivy $900 $800 more...data
3 1/8/04 Larson $300 $100 more...data
4 2/2/04 Guillett $700 $600 more...data
5 2/7/04 Peterson $800 $400 more...data
6 3/6/04 Kabel $500 $300 more...data
7 3/9/04 de Bruin $400 $200 more...data

I place a summary worksheet named "Consolidation" after worksheet 116
and use it to derive various sums of values from the collection of 116
worksheets.

Question:
How would one programatically loop through all 116 data worksheets
beginning with the first worksheet, determine the largest sum of range
Cx:Dx (where x=row number) that occured during each month (number of
rows per month varies from month to month) and list those results for
each worksheet within range N1:Z116 of the Consolidation worksheet to
achieve the following? Column N lists name of worksheet, and Columns
O:Z are used for monthly largest sum of Cx:Dx.

N O P Q R S ... Z
1 1/04 2/04 3/04 4/04 5/04 12/04
2 001 $1700 $1300 $800
3 002 (loop thru all 116 worksheets and repeat for each sheet)
4 003

I have been unable to locate any prior posts that illustrate methods
to determine the largest sum of two cells in a range and where the
range limits vary according to dates. Harder to explain than I thought
it would be...hope someone can weigh in with possibilites.

TIA for any response...

Mike Taylor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Largest sum of two values in wksht collection

Can you explain what to you mean by "Largest sum of range Cx:Dx' ?
Do you mean add C2+C3+C4..... + D2+D3+D4.... for each sheet,
and out of 116 sheets, the which is largest, to be identified ?

Sharad

"Mike Taylor" wrote in message
om...
Can someone offer help with code that will programmaticaly loop thru a
worksheet collection in a workbook, determine the largest sum of two
cells within a monthly range, and summarize those results in a summary
worksheet? The following is provided in the hope it clarifies what I
am trying to achieve.

Situation:
A workbook contains 116 data worksheets each of which are identical
except for the values of their cells. Worksheet names are determined
by value of cell A1 in each respective worksheet (format "000"). A
simplified example of the first worksheeet named "001" is as follows:

A B C D E ... G
1 001
2 1/1/04 Olgivy $900 $800 more...data
3 1/8/04 Larson $300 $100 more...data
4 2/2/04 Guillett $700 $600 more...data
5 2/7/04 Peterson $800 $400 more...data
6 3/6/04 Kabel $500 $300 more...data
7 3/9/04 de Bruin $400 $200 more...data

I place a summary worksheet named "Consolidation" after worksheet 116
and use it to derive various sums of values from the collection of 116
worksheets.

Question:
How would one programatically loop through all 116 data worksheets
beginning with the first worksheet, determine the largest sum of range
Cx:Dx (where x=row number) that occured during each month (number of
rows per month varies from month to month) and list those results for
each worksheet within range N1:Z116 of the Consolidation worksheet to
achieve the following? Column N lists name of worksheet, and Columns
O:Z are used for monthly largest sum of Cx:Dx.

N O P Q R S ... Z
1 1/04 2/04 3/04 4/04 5/04 12/04
2 001 $1700 $1300 $800
3 002 (loop thru all 116 worksheets and repeat for each sheet)
4 003

I have been unable to locate any prior posts that illustrate methods
to determine the largest sum of two cells in a range and where the
range limits vary according to dates. Harder to explain than I thought
it would be...hope someone can weigh in with possibilites.

TIA for any response...

Mike Taylor



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Largest sum of two values in wksht collection

application.Evaluate("Max(if(Month(A2:A30)=2,C1:C3 0+D1:D30,0))")

Should give you the largest sum for a particular month.

You would just need to write code to generate the correct formula.
(basically, build the formula string, then pass it to evaluate).

--
Regards,
Tom Ogilvy



"Mike Taylor" wrote in message
om...
Can someone offer help with code that will programmaticaly loop thru a
worksheet collection in a workbook, determine the largest sum of two
cells within a monthly range, and summarize those results in a summary
worksheet? The following is provided in the hope it clarifies what I
am trying to achieve.

Situation:
A workbook contains 116 data worksheets each of which are identical
except for the values of their cells. Worksheet names are determined
by value of cell A1 in each respective worksheet (format "000"). A
simplified example of the first worksheeet named "001" is as follows:

A B C D E ... G
1 001
2 1/1/04 Olgivy $900 $800 more...data
3 1/8/04 Larson $300 $100 more...data
4 2/2/04 Guillett $700 $600 more...data
5 2/7/04 Peterson $800 $400 more...data
6 3/6/04 Kabel $500 $300 more...data
7 3/9/04 de Bruin $400 $200 more...data

I place a summary worksheet named "Consolidation" after worksheet 116
and use it to derive various sums of values from the collection of 116
worksheets.

Question:
How would one programatically loop through all 116 data worksheets
beginning with the first worksheet, determine the largest sum of range
Cx:Dx (where x=row number) that occured during each month (number of
rows per month varies from month to month) and list those results for
each worksheet within range N1:Z116 of the Consolidation worksheet to
achieve the following? Column N lists name of worksheet, and Columns
O:Z are used for monthly largest sum of Cx:Dx.

N O P Q R S ... Z
1 1/04 2/04 3/04 4/04 5/04 12/04
2 001 $1700 $1300 $800
3 002 (loop thru all 116 worksheets and repeat for each sheet)
4 003

I have been unable to locate any prior posts that illustrate methods
to determine the largest sum of two cells in a range and where the
range limits vary according to dates. Harder to explain than I thought
it would be...hope someone can weigh in with possibilites.

TIA for any response...

Mike Taylor



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
1st 2 rows of wksht show up @ top of each page of the wksht Remote Paralegal Excel Discussion (Misc queries) 2 October 6th 08 07:59 PM
Largest of Two Values JerryS Excel Worksheet Functions 6 March 1st 08 12:54 AM
Adding a collection to a wksht CLamar Excel Discussion (Misc queries) 1 June 23rd 06 04:31 PM
find largest values, then return corresponding row values. neurotypical Excel Discussion (Misc queries) 7 May 24th 06 10:27 PM
Compare Listbox values with Collection values Stuart[_5_] Excel Programming 2 September 20th 03 01:58 PM


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