Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VLookup multiple values - sum returned values into single cell | Excel Worksheet Functions | |||
Counting multiple values within single cells | Excel Worksheet Functions | |||
Looking up multiple values for a single name | Excel Worksheet Functions | |||
create a list of single values from multiple values | Excel Worksheet Functions | |||
Search multiple values to return single values | Excel Worksheet Functions |