Adding a set of numbers and inserting a blan row
In column A I have data sorted by cities. In column D I have a column with a
duration in 5, 10, 15, 20, 25 and 30.
I have the following which counts the duration for each city in column A:
With ActiveSheet
LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = LastRow + 1 To 2 Step -1
If .Cells(i, "A").Value < .Cells(i - 1, "A").Value Then
For j = 30 To 5 Step -5
.Rows(i).Insert
.Cells(i, "D").Value = j
.Cells(i, "E").Formula = _
"=SUMPRODUCT(--(A1:A" & LastRow & "=""" & _
.Cells(i - 1, "A").Value & """),--(d1:d" &
LastRow & "=" & j & "))"
If .Cells(i, "d").Value = 0 Then Rows(i).Delete
Next j
End If
Next i
End With
What I need now is to total the values in column E in the next row and then
add a blank row.
|