3D sum using VBA
Gareth,
If you put this in a Module you can use it like a normal worksheet
function. You call it like this
=SumAcrossSheets(A1,"WE*")
and it will return #Value! if one (or more) of the values is not
numeric...
Public Function SumAcrossSheets(rngCellRef As Range, strID As String)
As Long
Dim intInc As Integer
Application.Volatile
For intInc = 1 To ThisWorkbook.Worksheets.Count
With ThisWorkbook.Worksheets(intInc)
If .Name Like strID Then
Let SumAcrossSheets = SumAcrossSheets +
..Range(rngCellRef.Address)
End If
End With
Next intInc
End Function
Hth,
OJ
|