LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tom
 
Posts: n/a
Default VBA assistance - Summing by grouping

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protected cells and grouping JimS Excel Discussion (Misc queries) 1 January 5th 06 03:28 AM
worksheet tabs do not respond to grouping Cleared for Take-Off Excel Discussion (Misc queries) 3 November 1st 05 12:36 AM
Grouping stuart.young Excel Discussion (Misc queries) 1 August 1st 05 12:56 PM
How to unprotect Grouping controls Bob Laithwaite Excel Worksheet Functions 1 May 18th 05 01:32 AM
Date Format Pivot Grouping Easton Excel Discussion (Misc queries) 1 March 8th 05 12:53 PM


All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"