+ Reply to Thread
Results 1 to 7 of 7

How Can I Have Excel Insert 20 Rows After Every 6th Row?

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Question How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Morning all.

    I want to insert 20 blank rows after every 6th row of data I have.

    This is in order to copy and paste my data into a separate pre-formatted sheet (I have read that there is no way of pasting into visible cells only).

    I have little VBA experience, but I'm sure this must be possible. I have found various codes for doing this, but I am unsure which parts of the codes to edit to achive the number of rows I'm after. Any help would be most appriciated.

    Thanks ,

    Sean

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    "I have read that there is no way of pasting into visible cells only"
    With a macro you could certainly do it.
    What a bout a short sample to illustrate you need

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Hi, Sean,

    maybe have a look at this code:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    05-29-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Hi PCI,

    I've attached as brief an example as I can.
    I need to copy the data from sheet1 and paste it into sheet2. So, sheet1 cells A1:D6 would go into sheet2 A4:D9, and sheet1 cells A7:D12 would go into sheet2 A17:D22 etc...

    My first step was to temporarily hide the rows I wanted to skip whilst pasting the data across, but it treats the hidden cells just as it would visible ones.

    My original data set contains about 2000 rows.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-29-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Thank you Holger, that worked perfectly.
    I really must sit down and get the hang of scripting these one day!

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Another variation to copy directly from sheet1 to sheet2
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-29-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How Can I Have Excel Insert 20 Rows After Every 6th Row?

    Excellent, thanks PCI.
    This will really save me some time.

+ 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. How to perform 'insert rows' instead of 'copy rows' using .copyrecordset (excel vba)
    By praful k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2013, 06:06 AM
  2. Replies: 1
    Last Post: 12-02-2011, 09:03 AM
  3. insert rows into excel sheet
    By hputhraya in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2010, 10:23 AM
  4. [SOLVED] Macro to insert rows in Excel
    By kden in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-19-2005, 01:06 PM
  5. Insert Rows with Excel Macro
    By birkato in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2005, 07:10 PM

Tags for this Thread

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