Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I seem to be having a problem with this code. I have a spreadhseet
with a multitude of items. These items have been grouped by their item number. Separating each grouping are two blank rows. I would like to total the values in the 6th column of the individual item groupings and insert that value directly below the last item in the group. Any and all help is much appreciated. Thanks in advance. My VBA code is located below. Sub Totals() Dim TotalFreq As Range Set TotalFreq = Range(Cells(StartRow, 6), Cells(EndRow, 6)) If StartRow = EndRow Then SumFreq = Cells(StartRow, 6).Value Else: SumFreq = Application.WorksheetFunction.Sum(TotalFreq) End If LastRow = Range("A65532").End(xlUp).Row ThisItem = Cells(I, 1).Value NextItem = Cells(I + 1, 1).Value PrevItem = Cells(I - 1, 1).Value For I = 3 To LastRow If IsEmpty(ThisItem) Then ElseIf ThisItem = NextItem Then If ThisItem < PrevItem Then StartRow = I End If ElseIf ThisItem = NextItem Then If ThisItem = PrevItem Then End If ElseIf ThisItem = PrevItem Then If IsEmpty(NextItem) Then EndRow = I End If End If Cells(I + 1, 6).Value = SumFreq Next I End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
totalling values based on conditions | Excel Discussion (Misc queries) | |||
Totalling coded values | Excel Worksheet Functions | |||
Totalling Values From The Same Cell In 12 Worksheets Onto New Shee | Setting up and Configuration of Excel | |||
Totalling unique values | Excel Discussion (Misc queries) | |||
Totalling values across columns | Excel Worksheet Functions |