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
|