+ Reply to Thread
Results 1 to 10 of 10

Copy and Paste Row 1:1 into Blank Rows

  1. #1
    Registered User
    Join Date
    05-07-2014
    Location
    Nevada
    MS-Off Ver
    Excel 365
    Posts
    17

    Copy and Paste Row 1:1 into Blank Rows

    Good Morning,

    I have basic VBA Skills. My spreadsheet has a lot of rows and columns with row G with address numbers. I am using the following code to enter a blank line before each number that doesn't match the one below it For example:
    234
    234
    235
    236
    236
    becomes:
    234
    234

    235

    236
    236

    Please Login or Register  to view this content.
    I also need to copy and paste row 1 into each of the newly created blank rows. I want to copy and paste so the format will be maintained. I have this below but I have to manually enter each row to enter it which defeats the purpose of automating.

    Please Login or Register  to view this content.
    I would like this to be combined into one single code and have it auto fill.

    Thank you for your help in advance.
    Last edited by Caraexcel; 05-09-2014 at 12:09 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy and Paste Row 1:1 into Blank Rows

    can you attach a sample file with data and desired result ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    05-07-2014
    Location
    Nevada
    MS-Off Ver
    Excel 365
    Posts
    17

    Re: Copy and Paste Row 1:1 into Blank Rows

    Please see attached. Thank you very much. I hope I attached it correctly, please let me know if you can't get it. I had to change the information to basic info but it should be ok for what is needed.

    Thank you
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy and Paste Row 1:1 into Blank Rows

    I asked for desired result

  5. #5
    Registered User
    Join Date
    05-07-2014
    Location
    Nevada
    MS-Off Ver
    Excel 365
    Posts
    17

    Re: Copy and Paste Row 1:1 into Blank Rows

    I apologize, I want the first row copied and inserted below a row where the address numbers are not the same. I attached the same spreadsheet but with the results I want. This is a much smaller version of the entire file.
    Attached Files Attached Files

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

    Re: Copy and Paste Row 1:1 into Blank Rows

    Hi, Caraexcel,

    Your opening post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    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

  7. #7
    Registered User
    Join Date
    05-07-2014
    Location
    Nevada
    MS-Off Ver
    Excel 365
    Posts
    17

    Re: Copy and Paste Row 1:1 into Blank Rows

    Hello,

    Thank you I think I have it now?

    Thank you,
    Cara

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

    Re: Copy and Paste Row 1:1 into Blank Rows

    Hi, Cara,

    the worst thing to do is start with VBA and use MergedCells. Get rid of these as they will only bloat the code with unnecessary attributes in order to perfom.

    Run this code on a copy of the worksheet
    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

  9. #9
    Registered User
    Join Date
    05-07-2014
    Location
    Nevada
    MS-Off Ver
    Excel 365
    Posts
    17

    Re: Copy and Paste Row 1:1 into Blank Rows

    Holger,

    It worked perfectly, over 26,000 rows so it took a while but I honestly cannot tell you how much I appreciate this, 3 days pulling my hair out and you did it in just a short while, you are wonderful!

    Great first time experience with this forum!

    THANK YOU!
    Cara

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

    Re: Copy and Paste Row 1:1 into Blank Rows

    Hi, Cara,

    if everything is working like you want please consider to mark this thread as Solved via Thread-Tools over the opening post.

    Ciao,
    Holger

+ 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. Copy Formula from set cells, paste in blank rows below as value
    By cappie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2013, 02:45 PM
  2. Copy list - paste link - blank rows between cells
    By adame in forum Excel General
    Replies: 0
    Last Post: 06-08-2011, 10:56 AM
  3. Copy Paste Formula on Each Blank Rows
    By triaji in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2010, 10:53 AM
  4. Copy and paste non blank rows from a range
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 10-12-2010, 09:29 AM
  5. Copy rows untill blank row then paste into new sheet
    By Chris Salcedo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2005, 03:05 PM

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