W
Winshent
I have a spread which stores past and present data.
I want to be able to show a sum of the data that is visible before and
after grouping is applied. I have some code which runs when an
autofilter is used (see below), but this doesnt work for grouping.
Public Function SumVisible(rng)
Dim CellSum As Long
Dim Cell As Range
Application.Volatile
CellSum = 0
Set rng = Intersect(rng.Parent.UsedRange, rng)
For Each Cell In rng
If IsNumeric(Cell) Then
If Not Cell.EntireRow.Hidden And Not Cell.EntireColumn.Hidden Then
CellSum = CellSum + Cell
End If
End If
Next Cell
SumVisible = CellSum
End Function
I want to be able to show a sum of the data that is visible before and
after grouping is applied. I have some code which runs when an
autofilter is used (see below), but this doesnt work for grouping.
Public Function SumVisible(rng)
Dim CellSum As Long
Dim Cell As Range
Application.Volatile
CellSum = 0
Set rng = Intersect(rng.Parent.UsedRange, rng)
For Each Cell In rng
If IsNumeric(Cell) Then
If Not Cell.EntireRow.Hidden And Not Cell.EntireColumn.Hidden Then
CellSum = CellSum + Cell
End If
End If
Next Cell
SumVisible = CellSum
End Function