Hello there, have been provided with a lovely bit of code that adds
cells in column E and places total in column C in the row above the
values it is totalling.

The code works beautifully for adding 2 or more values together, but
falls over when there is only one value to sum.

Application.ScreenUpdating = False
lr = Cells(Rows.Count, "c").End(xlUp).Row
e1 = Cells(1, "c").End(xlDown).Row

Do Until e1 >= lr
e2 = Cells(e1, "c").End(xlDown).Row

Set myrange = Range(Cells(e1, "e"), Cells(e2, "e"))
Cells(e1 - 1, "c") = Application.sum(myrange)

e1 = Cells(e2, "c").End(xlDown).Row
Loop

Application.ScreenUpdating = True


Any one give me a clue as to what needs to happen for it to include sum
function for just one value?

0 B11111 60 20/06/2006
1 B11111 007005 20 20.00
1 B11111 007003 40 40.00
0 B22222 34.71 20/06/2006
1 B22222 003011 1 15.05
1 B22222 005001 1 19.66
0 B33333 38.06 20/06/2006
1 B33333 005003 1 24.48
0 B44444 20/06/2006
1 B44444 005005 1 13.58
0 B55555 20/06/2006
1 B55555 007001 1 33.57

This is the result I get, first 2 calculations fine, last 3 don't
work??????

Many thanks, Bev J