![]() |
Creating Loops
Hi David
try the following macro. It tests column A and inserts a blank row if the values change Sub insert_rows() Dim lastrow As Long Dim row_index As Long lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row For row_index = lastrow - 1 To 1 Step -1 If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Value Then Cells(row_index + 1, "A").resize(10,1).EntireRow.Insert (xlShiftDown) End If Next End Sub -- Regards Frank Kabel Frankfurt, Germany David wrote: I have a list of 40 names, and I need to insert 10 rows in between each of them and then copy a formula from c2..ac10 and then move down to the name and do it again. |
Creating Loops
Thanks frank, the insertion of rows works perfect, but now I need to copy a formula and put that in the various name, the formula is from c2 to ac11, any help you can provide would be greatly appreciated. I literally have 500 names that I have to do this for
----- Frank Kabel wrote: ---- Hi Davi try the following macro. It tests column A and inserts a blank row i the values chang Sub insert_rows( Dim lastrow As Lon Dim row_index As Lon lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).ro For row_index = lastrow - 1 To 1 Step - If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Valu The Cells(row_index + 1, "A").resize(10,1).EntireRow.Inser (xlShiftDown End I Nex End Su - Regard Frank Kabe Frankfurt, German David wrote I have a list of 40 names, and I need to insert 10 rows in betwee each of them and then copy a formula from c2..ac10 and then move dow to the name and do it again |
All times are GMT +1. The time now is 06:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com