Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have been working on inserting a line whenever the cost centre changes, then summing the next 10 columns to the right. I have found some code which inserts a row and sums the like totals of only one column. Can someone help with extending it out 10 columns. I don't want to use the subtotal function for a range of reasons. Ta eg AA 2 5 AA 2 4 Total 4 9 BB 4 6 BB 4 3 Total 8 9 Regards Chad Sub sumrow() Dim Start As Range, Cell As Range Set Start = Range("C1") Set Cell = Range("B2") Do While Not IsEmpty(Cell) If Cell.Value < Cell(0).Value Or _ Cell(1, 0).Value < Cell(0, 0).Value Then Cell.EntireRow.Insert Cell(0, 2).Formula = "=sum(" & _ Range(Start, Cell(-1, 2)).Address & ")" Set Start = Cell(1, 2) End If Set Cell = Cell(2, 1) Loop Cell(1, 2).Formula = "=sum(" & _ Range(Start, Cell(0, 2)).Address & ")" End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert rows: Formats & formulas extended to additonal rows | Excel Worksheet Functions | |||
Insert New Line | Excel Discussion (Misc queries) | |||
Insert two rows in one line of code? | Excel Programming | |||
Insert each line in a new row | Excel Discussion (Misc queries) | |||
My rows are off by one row, ie. data on line 10 should line up wi. | New Users to Excel |