macro to add 24 rows to each group in column H

G

Guest

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
 

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

Top