Excel: Inherit based on Grouping Levels
Sometimes you would like to inherit the cell value based on the grouping (aka outline) level. This macro looks for blanks and then populates the cells based on the next highest up value above the cell.
Sub Inherit()
' Inherit value based on next highest grouping level
Dim c As Range
Dim x As Range
For Each c In Selection
For i = c.Row To 1 Step -1
Set x = Cells(i, c.Column)
' If c.Value = "" Then ' Only populate blanks
If c.EntireRow.OutlineLevel > x.EntireRow.OutlineLevel Then
c.FormulaR1C1 = "=R" & i & "C[0]"
Exit For
End If
' End If
Next i
Next c
End Sub