Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default 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



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
Loops SaraJane Excel Discussion (Misc queries) 11 May 26th 07 04:47 AM
Loops... Willabo Excel Discussion (Misc queries) 2 June 14th 06 04:08 PM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
Using For - Next Loops in VB Biomed New Users to Excel 1 March 21st 05 09:35 PM
help with loops Rick B[_6_] Excel Programming 8 January 28th 04 12:32 AM


All times are GMT +1. The time now is 07:27 AM.

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

About Us

"It's about Microsoft Excel"