MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Subtotals - Labels


Posted by JC on October 26, 2001 3:33 PM

Can you create subtotals, but label them with custom titles?


Posted by . on October 26, 2001 11:21 PM

I think only with VBA.

Posted by JC on October 30, 2001 1:33 PM

Posted by . on October 30, 2001 4:30 PM


Let's say your sub-totals are based on each change in column A and a column other than column B is sub-totaled. This sort of thing could be done :-

Dim cell As Range, rng As Range
Set rng = Range(Range("B1"), Range("B65536").End(xlUp).Offset(1, 0)).SpecialCells(xlCellTypeBlanks).Offset(0, -1)
rng.HorizontalAlignment = xlCenter 'Or whatever you want to do
For Each cell In rng
cell.Value = cell.Offset(-1, 0).Value 'Or whatever you want to do
Next