M
Matthew Pfluger
I know that it is faster to grab an range of cells and send it to an array.
Can I then access Range properties from that array? For example, I want to
Sum all cells in a range that are not header rows (i.e. rows that contain a
'+'). To do this, I need to check the OutlineLevel property.
Example code:
Public Function SumIfNotHeading(ByRef rng As Range) As Double
SumIfNotHeading = 0
' Add cell value if row has not a header
Dim cell As Range
For Each cell In rng
If Not bIsHeading(cell) Then
SumIfNotHeading = SumIfNotHeading + cell.Value
End If
Next cell
End Function
Function bIsHeading(ByRef rng As Range) As Boolean
bIsHeading = (rng.EntireRow.OutlineLevel < rng.Offset(1,
0).EntireRow.OutlineLevel)
End Function
Is this possible, or is there a better way? Thanks.
Matthew Pfluger
Can I then access Range properties from that array? For example, I want to
Sum all cells in a range that are not header rows (i.e. rows that contain a
'+'). To do this, I need to check the OutlineLevel property.
Example code:
Public Function SumIfNotHeading(ByRef rng As Range) As Double
SumIfNotHeading = 0
' Add cell value if row has not a header
Dim cell As Range
For Each cell In rng
If Not bIsHeading(cell) Then
SumIfNotHeading = SumIfNotHeading + cell.Value
End If
Next cell
End Function
Function bIsHeading(ByRef rng As Range) As Boolean
bIsHeading = (rng.EntireRow.OutlineLevel < rng.Offset(1,
0).EntireRow.OutlineLevel)
End Function
Is this possible, or is there a better way? Thanks.
Matthew Pfluger