+ Reply to Thread
Results 1 to 7 of 7

Duplicate line x times

  1. #1
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Question Duplicate line x times

    Good Day

    I have an excel sheet that has 5 columns:

    A1 = ID
    A2 = Item
    A3 = Description
    A4 = Quantity
    A5 = Price

    I am trying to write a macro to add X amount of lines to new sheet depending on the Quantity value.

    IE. if the Quantity is 5 it should have 5 of that line moved to the next page etc

    the QTY will not pull through to the next page for it's now only 1
    Last edited by Sniper; 10-21-2013 at 11:27 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Duplicate line x times

    Hi Sniper. Did you mean A1,B1,C1,D1,E1 instead of A1 to A5?

  3. #3
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Duplicate line x times

    Sorry Yes, A1 - E1

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Duplicate line x times

    Maybe:

    Please Login or Register  to view this content.
    In this case Sheet3 is the destination Sheet.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Duplicate line x times

    Hi Sniper. Assuming you have more than one quantity going down column D, do you want to copy each row 5 times to another sheet based on each quantity or do you want to choose only one row?

  6. #6
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Duplicate line x times

    Hi

    Just had a look at your code and it seems to do exactly what I wanted it to!!! Thanks John..

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Duplicate line x times

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. Line graph lap times
    By hjtrbo in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-17-2013, 03:45 AM
  2. Looking to duplicate Excel rows seven times
    By fredericklewis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2013, 05:05 PM
  3. Duplicate row [A1] times?
    By Amina in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-22-2012, 11:30 AM
  4. [SOLVED] Duplicate a sheet a number of times
    By AB33 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2012, 11:42 AM
  5. Excel 2007 : Duplicate rows a given number of times
    By kayell in forum Excel General
    Replies: 1
    Last Post: 04-03-2011, 12:58 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