+ Reply to Thread
Results 1 to 4 of 4

Macro in Excel to repeat entire row n number of times

  1. #1
    Registered User
    Join Date
    02-11-2015
    Location
    Exeter, UK
    MS-Off Ver
    2010
    Posts
    2

    Lightbulb Macro in Excel to repeat entire row n number of times

    Hi,

    I need a macro in EXCEL to repeat entire rows n number of times where n is in the row to be repeated. I have tried using answers already here but they produce either 1 too many rows, or do not copy the entire row. Ie:

    Col1 Col2 Col3 Col4 Col5
    ABC ABC ABC ABC 2
    DEF DEF DEF DEF 3

    Macro produces
    ABC ABC ABC ABC 2
    ABC ABC ABC ABC 2
    DEF DEF DEF DEF 3
    DEF DEF DEF DEF 3
    DEF DEF DEF DEF 3

    Thank you so much for anyone's help, really appreciated.

    Tom

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Macro in Excel to repeat entire row n number of times

    This is modified from some ancient code of mine, so it's a bit inelegant, but it should work.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-11-2015
    Location
    Exeter, UK
    MS-Off Ver
    2010
    Posts
    2

    Re: Macro in Excel to repeat entire row n number of times

    Thanks for your help so far! But I can't get it to work :-(

    I get a runtime error '13' - Type mismatch

    Related to line For j = 2 To Reps

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Macro in Excel to repeat entire row n number of times

    Is every value in column D an integer? Do you maybe have a header row that isn't a number? If so, just change the i = 1 to whatever row has the first integer value.

+ 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. Macro help needed to repeat column A entries to specified number of times
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2015, 04:02 PM
  2. macro needed to repeat cell values for a specified number of times
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2014, 06:54 AM
  3. [SOLVED] Need Macro to repeat row specific number of times
    By KimberlyS in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-23-2014, 06:12 PM
  4. [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
  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

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