+ Reply to Thread
Results 1 to 3 of 3

Macro For Inserting Rows, After Every Nth Row and adding text to the inserted row

Hybrid View

  1. #1
    Registered User
    Join Date
    05-26-2014
    Posts
    2

    Red face Macro For Inserting Rows, After Every Nth Row and adding text to the inserted row

    Hey,

    I have the macro to insert rows every nth row, but need to be able to insert text into that nth row.

    I have a list of addresses and every 10 addresses i need to insert a 'seed' which will be have the same details everytime.
    This is what i have so far...

    Sub InsertRowsMod10()
    Dim r As Long
    r = 10
    Do Until Len(Cells(r, 1)) = 0
    Rows(r).Insert Shift:=xlDown
    r = r + 10
    Loop
    End Sub

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Macro For Inserting Rows, After Every Nth Row and adding text to the inserted row

    PHP Code: 
    Option Explicit
    Sub GPE_AddRows
    ()
     
    Dim Rng As Range
     Dim Rws 
    As LongAs Long

     Set Rng 
    ThisWorkbook.Worksheets("Sheet2").UsedRange
     Rws 
    Rng.Rows.Count
     Rws 
    Rws - (Rws Mod 10)
     For 
    Rws To 9 Step -10
        Rows
    (":" J).Insert Shift:=xlDown
        Cells
    (J"B").Value "GPE.COM"
     
    Next J
    End Sub 

  3. #3
    Registered User
    Join Date
    05-26-2014
    Posts
    2

    Wink Re: Macro For Inserting Rows, After Every Nth Row and adding text to the inserted row

    Awesome, perfect! thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copying and Inserting Range of Rows After Last One Inserted
    By swoosiebur in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2013, 01:54 PM
  2. Replies: 0
    Last Post: 05-10-2013, 12:04 PM
  3. Replies: 0
    Last Post: 04-18-2011, 06:39 PM
  4. inserting a row and adding the new rows?
    By mkabs11 in forum Excel General
    Replies: 6
    Last Post: 03-17-2011, 04:54 PM
  5. Macro to format inserted rows
    By SilverFox in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-16-2009, 06:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1