+ Reply to Thread
Results 1 to 4 of 4

Insert 2 rows between every line of data (Excel 2010)

Hybrid View

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    5

    Insert 2 rows between every line of data (Excel 2010)

    Hi,

    I'm looking for a macro to use in excel 2010 that will insert 2 rows in between every row of data (500 rows) in a sheet? Any help, greatly appreciated. If possible could you also explain to me how to edit the macro to insert 1 row only or to edit the data range for example?

    Also, can anyone recommend a good book for writing macros & using formula with vba etc?


    Thanks,

    Louise

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    923

    Re: Insert 2 rows between every line of data (Excel 2010)

    Have a try with this macro placed in the sheets VB code module.
    No empty rows expected in the used range.
    Sub Insert_Rows()
    '
    ' Macro by rollis13 - 10/09/2012
    '
        LR = Cells(Rows.Count, "A").End(xlUp).Row   'find last row with data in column A
        
        For a = LR To 2 Step -1                     'stop at row 2 (titles in row 1)
            For b = 1 To 2                          'change as needed for n. rows be inserted (2 at the moment)
                Cells(a + 1, 1).EntireRow.Insert Shift:=xlDown
            Next b
        Next a
    
    End Sub
    Last edited by rollis13; 09-11-2012 at 06:56 PM.

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Insert 2 rows between every line of data (Excel 2010)

    Hi, thanks a mill. This was really helpful and works perfectly.

    Louise

  4. #4
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    923

    Re: Insert 2 rows between every line of data (Excel 2010)

    Glad been of some help .

+ 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