Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

macro to add 24 rows to each group in column H

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Janis - 24 Sep 2007 20:08 GMT
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
Janis - 24 Sep 2007 20:30 GMT
reposted

> 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.  
[quoted text clipped - 17 lines]
>
> thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.