Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default MAX Value of a CELL in ALL sheets in a workbook


Is there a way to display in sheet1 the MAX value of a cell through ALL
sheets in that workbook ?

Say [T55].
I want this cell to display the MAX value in all sheets [J55].

I want to use this as a quote number, but not every sheet will have a value.
I tried a MAX formula, but i need to know the 1st and Last sheet names
before hand.

Regards

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default MAX Value of a CELL in ALL sheets in a workbook

Corey wrote:
Is there a way to display in sheet1 the MAX value of a cell through ALL
sheets in that workbook ?

Say [T55].
I want this cell to display the MAX value in all sheets [J55].

I want to use this as a quote number, but not every sheet will have a value.
I tried a MAX formula, but i need to know the 1st and Last sheet names
before hand.

Regards

Corey....


Hi Corey,

Have you looked at the following topic in Help?...

"Refer to the same cell or range on multiple sheets"

It seems to me that this is what you are trying to do.

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default MAX Value of a CELL in ALL sheets in a workbook

Ken,
Thanks for the reply.

I will see if i can work through some of the help files....

Corey....
"Ken Johnson" wrote in message
ups.com...
Corey wrote:
Is there a way to display in sheet1 the MAX value of a cell through ALL
sheets in that workbook ?

Say [T55].
I want this cell to display the MAX value in all sheets [J55].

I want to use this as a quote number, but not every sheet will have a
value.
I tried a MAX formula, but i need to know the 1st and Last sheet names
before hand.

Regards

Corey....


Hi Corey,

Have you looked at the following topic in Help?...

"Refer to the same cell or range on multiple sheets"

It seems to me that this is what you are trying to do.

Ken Johnson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default MAX Value of a CELL in ALL sheets in a workbook

Code i recorded below:

I ned to adapt this to look to ALL sheets.
The first sheet will always be "Template", BUT the LAST Sheet will change
all the time with NEW sheets added daily.
Therefore is there a LAST.SHEET code instead of "Template (4)" in this
example, SEE comments below in code.

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 26/06/2006 by Corey

'
Range("L53").Select
ActiveCell.FormulaR1C1 = "=MAX('Template:Template (4)'!R[-8]C[-10])" '
<========= Want the [Template (4)] to be a simple [LAST.SHEET] statement,
without refering to sheet BY name.
Range("L54").Select
End Sub

Can it be done ?

Corey....


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default MAX Value of a CELL in ALL sheets in a workbook

Hi Corey,

Try this...

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 26/06/2006 by Corey

Dim WbCount As Integer
WbCount = ActiveWorkbook.Worksheets.Count
Range("L53").Select
ActiveCell.FormulaR1C1 = "=MAX('Template:Template (" _
& WbCount & ")'!R[-8]C[-10])"
Range("L54").Select
End Sub

If your workbook has 10 sheets then WbCount will equal 10, so if your
last sheet is named Template(10) that should give the correct formula.

When I tried this line of code on a standard workbook with 3 sheets...
Sheet1, Sheet2, and Sheet3

ActiveCell.FormulaR1C1 = "=MAX('Sheet1:Sheet" & WbCount &
"'!R[-8]C[-10])"

I ended up with this formula in L53...

=MAX(Sheet1:Sheet3!B45)

Hope this is useful.

Ken Johnson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default MAX Value of a CELL in ALL sheets in a workbook

Thanks for the reply Ken.
The problem is the sheet name will NOT be Template (?).
Each sheet will be given a number value, and there will be no definite value
that could be calculated.
I was hoping there is a maybe, COUNT.LAST.SHEET. Get Sheet Name code??

Corey....

"Ken Johnson" wrote in message
ups.com...
Hi Corey,

Try this...

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 26/06/2006 by Corey

Dim WbCount As Integer
WbCount = ActiveWorkbook.Worksheets.Count
Range("L53").Select
ActiveCell.FormulaR1C1 = "=MAX('Template:Template (" _
& WbCount & ")'!R[-8]C[-10])"
Range("L54").Select
End Sub

If your workbook has 10 sheets then WbCount will equal 10, so if your
last sheet is named Template(10) that should give the correct formula.

When I tried this line of code on a standard workbook with 3 sheets...
Sheet1, Sheet2, and Sheet3

ActiveCell.FormulaR1C1 = "=MAX('Sheet1:Sheet" & WbCount &
"'!R[-8]C[-10])"

I ended up with this formula in L53...

=MAX(Sheet1:Sheet3!B45)

Hope this is useful.

Ken Johnson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default MAX Value of a CELL in ALL sheets in a workbook

Hi Corey,

Try this...

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 26/06/2006 by Corey

Range("L53").Select
ActiveCell.FormulaR1C1 = "=MAX('Template:" & _
Worksheets(Worksheets.Count).Name & _
"'!R[-8]C[-10])"
Range("L54").Select
End Sub

It worked with Sheet1 named Template and any number of other sheets
regardless of their name. The resulting formula in L53 returns the
maximum of the B45 cell values on all of the sheets.

Hope it works for you too.

Ken Johnson

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
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
get value from same cell on all sheets in a workbook. GeneWan Excel Programming 6 May 15th 06 05:41 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM
Select the same cell in different sheets in the same workbook? PEA Excel Programming 0 September 3rd 05 07:40 AM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"