+ Reply to Thread
Results 1 to 3 of 3

Macro to insert line and copy text from above

  1. #1
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Macro to insert line and copy text from above

    Hi,

    I'm waiting to receive the document itself but the idea is we have a row which contains information and in a column will have a number for how many times that needs to be repeated.

    I need be able to run a macro and it will add in the number of rows below each entry but also copy and paste the information into those new rows.

    So before Macro :

    1 New Lane AB1 2CD 3
    2 New Lane AB1 2CD 2

    After

    1 New Lane AB1 2CD 3
    1 New Lane AB1 2CD 3
    1 New Lane AB1 2CD 3
    2 New Lane AB1 2CD 2
    2 New Lane AB1 2CD 2

    I understand the code will be column relevant which I don't have at the moment but I should be able to edit that myself.

    Regards

    Dave

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Macro to insert line and copy text from above

    Look at this link

    http://stackoverflow.com/questions/1...plicate-values
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Macro to insert line and copy text from above

    Thanks for the link.

    I have however started with this piece of code which works well, apart from the values of 1 are inserting a line also so I'm having to remove duplicates for these. Any idea what I need to tweak in the code? Anything 2 or greater inserts the correct number of rows.

    Please Login or Register  to view this content.

+ 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. Insert line and copy data of previous line with certain changes
    By vijayca in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2016, 07:19 AM
  2. Replies: 1
    Last Post: 02-01-2013, 01:57 AM
  3. [SOLVED] Macro to Insert copy of Row based on text String
    By j2591 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 09:32 AM
  4. Altering this macro: Insert copy of line in same place on 2 sheets!
    By gangel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-16-2012, 04:10 AM
  5. Macro to Copy down and insert line continously
    By exc1967 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2012, 02:22 PM
  6. Insert new rows and copy text macro help
    By b50 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2011, 03:17 PM
  7. Macro to insert a line and copy the formula from above
    By dimmockc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2008, 12:59 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