+ Reply to Thread
Results 1 to 4 of 4

Need a Macro that will duplicate rows a number of times based on a column value

  1. #1
    Registered User
    Join Date
    01-11-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Post Need a Macro that will duplicate rows a number of times based on a column value

    Hi,

    I'm completely new to VBA and excel and I've tried to alter various code examples I have found woth no success. Here's what I am trying to do:

    I have a spreadsheet with colums A-M. Column J has a number value. We want to run a mailmerge on this spreadsheet and column J is the number of times that row needs to be mailed out. So we need to duplicate each row based on the value the the J column. I've uploaded a sample spreadsheet. Sheet1 reperesents the current spreadsheet and sheet2 represents the desired outcome. It's important that the duplicated rows appear below the original. There are are 814 rows in the real spreadsheet.

    Any help would be greatly appreciated. I've spent 2 hours working with sample code from the solutions to similar problems but none seem to work the way I need them to.


    Best regards,

    Chris
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a Macro that will duplicate rows a number of times based on a column value

    Adapated from Mike7952's code

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-11-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Thumbs up Re: Need a Macro that will duplicate rows a number of times based on a column value

    Many thanks AB33. This worked perfectly.

    Thanks,

    Chris

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a Macro that will duplicate rows a number of times based on a column value

    Chris,
    You are welcome!
    Could you please now close this thread as "Solved". Go to the top right hand side of this page, choose solved from the "Thread tools" drop down menu.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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