3D sum using VBA
Thanks for this but I was hoping to do something like:
Sub totals()
Dim cell As Range
For Each cell in Range("B4:B30")
cell.value = 'whatever the code would be?
Next cell
End Sub
Is this possible?
Gareth
-----Original Message-----
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
.
|