Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default macro to add 24 rows to each group in column H

I need to add 24 rows to each service group in column H. The field is SG1,
SG2, SG3. For each subtotaled group at the end I need to add the 24 rows.
The do until range line
has an error. I also don't know how to make the insert line add 24 instead
of only one. So this macro compares each offset row to see where the next
service group starts and that is where I want the insert.

Private Sub PutARowIn()
Range("H12").Select
Do Until Range(Range("R2"), Cells(Rows.Count, "R").End(xlUp))

If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
End If
Loop
End Sub

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default macro to add 24 rows to each group in column H

reposted

"Janis" wrote:

I need to add 24 rows to each service group in column H. The field is SG1,
SG2, SG3. For each subtotaled group at the end I need to add the 24 rows.
The do until range line
has an error. I also don't know how to make the insert line add 24 instead
of only one. So this macro compares each offset row to see where the next
service group starts and that is where I want the insert.

Private Sub PutARowIn()
Range("H12").Select
Do Until Range(Range("R2"), Cells(Rows.Count, "R").End(xlUp))

If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
End If
Loop
End Sub

thanks

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
Group into rows by every change of Column A Jan[_3_] Excel Discussion (Misc queries) 2 June 3rd 08 09:35 PM
Group & sort rows that have a specific value in column C Lex Excel Worksheet Functions 3 October 31st 06 11:11 AM
Macro to concatenate multiple rows in a column, without selecting each group manually MikeM[_6_] Excel Programming 7 June 19th 06 06:15 PM
how would i select a group of rows based on a column value Brian Walker Excel Programming 1 June 15th 04 02:31 AM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


All times are GMT +1. The time now is 01:24 AM.

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"