+ Reply to Thread
Results 1 to 2 of 2

Insert 2 rows every nth row

  1. #1
    Registered User
    Join Date
    04-06-2006
    Posts
    11

    Insert 2 rows every nth row

    I would like a macro to insert 2 (or more) rows every 8th row.

    Thanks.

    B.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    This is one way

    Sub InsertRows()
    'insert 2 rows after every exiting 8th row
    Dim lEndRow As Long
    Dim lInstRow As Long

    lInstRow = 9
    Do
    lEndRow = Cells.Find(what:="*", searchorder:=xlByRows, _
    searchdirection:=xlPrevious).Row

    Rows(lInstRow).Resize(2, 256).Insert
    lInstRow = lInstRow + 10
    Loop Until lInstRow > lEndRow
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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