Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Search Columns For Change, Insert Blank Rows, and Sum Differen

Try this, with the sheet with the data being the active one.

Sub InsertRowsSums()
Dim iRow As Long
Dim iFirst As Long
Dim aColA As String
Dim aColB As String
iRow = 2
iFirst = 2
aColA = Cells(iRow, 1)
aColB = Cells(iRow, 2)
Do
iRow = iRow + 1
If Cells(iRow, 1) < aColA Or Cells(iRow, 2) < aColB Then
Rows(iRow & ":" & iRow + 1).Insert Shift:=xlDown
str1 = "D" & iFirst & ":D" & iRow - 1
Cells(iRow, 4).Formula = "=Sum(" & str1 & ")"
Cells(iRow, 4).Copy Range(Cells(iRow, 5), Cells(iRow, 7))
iRow = iRow + 2
iFirst = iRow
aColA = Cells(iRow, 1)
aColB = Cells(iRow, 2)
End If
Loop Until Cells(iRow, 1) = ""
End Sub

Hth,
Merjet


Reply
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
Text to Rows and then Insert Blank Rows [email protected] Excel Discussion (Misc queries) 1 December 20th 08 04:23 PM
How do i insert blank rows between data that is thousands of rows paul.eatwell Excel Discussion (Misc queries) 5 April 14th 08 10:49 PM
Search Columns For Change, Insert Blank Rows, and Sum Different Co Bagman Excel Programming 5 May 23rd 07 04:09 PM
How do I insert blank rows between rows in completed worksheet? bblue1978 Excel Discussion (Misc queries) 1 October 26th 06 07:02 PM
Insert a blank Column Every 9 Columns Nigel Bennett Excel Programming 4 March 15th 05 04:53 PM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"