+ Reply to Thread
Results 1 to 9 of 9

Duplicate row base on value given

  1. #1
    Registered User
    Join Date
    02-22-2008
    Posts
    13

    Duplicate row base on value given

    Hi there,


    Need help to build a vb script macro to duplicate the entire row base on the value given in Column A, the duplicates will be in sheet 2 always starting from A1. For example duplicate the row of B2 and C2 5 times, which is based on the value in A2. I may need to add in more columns in the future in D, E and so on.

    Attached is the example in the file attached
    Please do help

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Duplicate row base on value given

    Visiting a restuarant wouldn't be fine for my appetite...



  3. #3
    Registered User
    Join Date
    02-22-2008
    Posts
    13

    Re: Duplicate row base on value given

    Anyone can help on that request?

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Duplicate row base on value given

    hi, cjGod, please check attachment, run code "test" or press Run
    Attached Files Attached Files
    Last edited by watersev; 07-06-2011 at 07:01 AM.

  5. #5
    Registered User
    Join Date
    02-22-2008
    Posts
    13

    Re: Duplicate row base on value given

    Hi watersev,

    Many thanks for the help in creating the macros. It works well!
    But is there a way that I can edit the macros so that in the event I need to add in values in Column D and so on, it can duplicate accordingly also.

  6. #6
    Registered User
    Join Date
    02-22-2008
    Posts
    13

    Re: Duplicate row base on value given

    Hi There,

    Anyone can help me with this?

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Duplicate row base on value given

    yes, you can. Only you know what is added and what it should be as a result

  8. #8
    Registered User
    Join Date
    02-22-2008
    Posts
    13

    Re: Duplicate row base on value given

    Hi watersev,

    I have attached the previous excel file that you have sent with my changes needed.
    Is there a way to build a dynamic macros that I can change myself, in the event I need to add in new columns.


    Thanks
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Duplicate row base on value given

    hi, cjGod, please check attachment, run code "test". Try to add columns and run the code. The output is on a newly created sheet.
    Attached Files Attached Files

+ 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