+ Reply to Thread
Results 1 to 8 of 8

Need Macro to repeat row specific number of times

  1. #1
    Registered User
    Join Date
    04-19-2014
    Location
    St. Louis, MO, USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Need Macro to repeat row specific number of times

    I have never built or used a macro before and need very clear step by step instructions. I am just assuming that a macro is the answer to what I am looking for but if there is a simplier solution that would be fantastic.

    I need to be able to repeat a row of data a specified amount of times.

    Example:

    3 Yellow James
    2 Green Mark
    5 Purple Sue
    1 Orange David

    Needs to look like:

    3 Yellow James
    3 Yellow James
    3 Yellow James
    2 Green Mark
    2 Green Mark
    5 Purple Sue
    5 Purple Sue
    5 Purple Sue
    5 Purple Sue
    5 Purple Sue
    1 Orange David

    If anyone has a solution, I would really appreciate the help!

  2. #2
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Need Macro to repeat row specific number of times

    Try this

    Repeat_Rows.xlsm

  3. #3
    Registered User
    Join Date
    04-19-2014
    Location
    St. Louis, MO, USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Need Macro to repeat row specific number of times

    Wow. This is exactly what I need but how can I apply it to my own spreadsheet? The rows that I am using have more columns.

  4. #4
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Need Macro to repeat row specific number of times

    Can you send me your workbook and I will apply the code for you.
    1. Reply to thread and inform if suggestion was helpful or not
    2. Click on the star (=Add Reputation) if you think someone helped you
    3. Mark [SOLVED] to this thread if solution was found. (On Menu "Thread Tools" > "Mark this thread as solved")

  5. #5
    Registered User
    Join Date
    04-19-2014
    Location
    St. Louis, MO, USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Need Macro to repeat row specific number of times

    Unfortunately the data in my spreadsheet is confidential. Would you be able to walk me through building the macro on my own or is this too difficult? The spreadsheet I will be using has 11 columns and 2000 rows.

  6. #6
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Need Macro to repeat row specific number of times

    I have rewritten the code so it deals with unknown number of rows & columns. The result will be placed in Sheet2.

    Here is the workbook where you can see the commandbutton and the code. In your workbook:
    1. Copy and Paste the code in a module (Hope you are a little familiar with VBA Editor)
    2. Add a commandbutton in your worksheet and connect the subroutine

    Repeat_Rows(1).xlsm

    Here is the code:

    Please Login or Register  to view this content.

  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: Need Macro to repeat row specific number of times

    Another:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-19-2014
    Location
    St. Louis, MO, USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Need Macro to repeat row specific number of times

    This worked perfectly! Thank you so much!

+ 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. [SOLVED] To repeat row values, a specified number of times
    By ramananhrm in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-09-2014, 11:30 AM
  2. [SOLVED] How to repeat the same number for 'N" number of times in excel sheet
    By tulasiram in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-12-2013, 03:06 AM
  3. Macro or Eqn to Repeat Formula "X" times based on Number in Cell
    By waltheaj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2013, 12:24 PM
  4. [SOLVED] Macro - Repeat macro a specific number of times
    By uvinduds in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2013, 02:42 PM
  5. How to repeat a macro x number of times based on a value in a cell
    By gypsyhotelier in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2011, 05:11 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