VBA assistance - Summing by grouping

T

Tom

I am currently using this code (see below) to insert rows where the #'s
change in a column "E". Runs great, however I would like to sum the rows
proceeding the inserted rows (by Column - L,M,N,and O) .
TFTH,
Tom

Sub InsertRows()

Dim StartRow As Long
Dim DataColumn As Long
Dim LastRow As Long
Dim iRow As Long

With ActiveSheet
StartRow = 6
DataColumn = 5
LastRow = .Cells(.Rows.Count, DataColumn).End(xlUp).Row

For iRow = LastRow To StartRow Step -1
If .Cells(iRow, DataColumn).Value _
= .Cells(iRow - 1, DataColumn).Value Then
'do nothing
Else
.Rows(iRow).Resize(2).Insert
End If
Next iRow
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Remove Identical words 0
Creating a fixture list 3
VBA Assistance _ Summing 1
Insert a Row and then Sum 1
Save details 2
Inserting a row (update) 2
Delete duplicates? 2
Removing duplicates 6

Top