+ Reply to Thread
Results 1 to 7 of 7

Create Multiple Rows based on Cell Value by way of VBA

  1. #1
    Registered User
    Join Date
    04-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    51

    Create Multiple Rows based on Cell Value by way of VBA

    Good day everyone!

    I have an assignment under which I am required to create multiple rows for the same row data based on the number mentioned in column J.

    Let’s say if row 5 has 4 as the number in cell J5. I need to be able to copy that row data 4 times and so on and so forth

    Attached sample has original data in Blue and Data Requested in Green. I need to make a fresh workbook. The data is just a representation of my requested harvest.

    Please help me with a macro that can do this for me. I understand the limitation in terms of number of rows in excel but the data is or will be manageable.
    Attached Files Attached Files
    Best regards,
    Jason (aka avid2xl)

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Hi Avid2Xl..

    Can you please allow me to use Formula based approach..

    In A14.. use Array Formula as..
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Drag toward Down & Right for complete table..

    Please let us know if you need VBA solution..

    Regards,
    Deb

  3. #3
    Registered User
    Join Date
    04-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    51

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Thank you very much!

    But given the magnitude of data I would really request for a VBA as I want to create a new file everyday.

    Thank you.

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

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Try the attached
    Attached Files Attached Files

  5. #5
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Check this one too..

    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  6. #6
    Registered User
    Join Date
    04-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    51

    Re: Create Multiple Rows based on Cell Value by way of VBA

    AB33 and Deb - Thank you for your assistance. Both the things work well. It indeed was a very quick one...

    AB33 - I'll go with the one you provided as it helps me get the data to another sheet.

    A couple of things though:

    1. On running the script the data gets updated in the Output sheet but the last row of the worksheet (sheet1) gets selected and asks me to select a cell and press enter. Why would this be happening?
    2. Not necessary but if possible can I have the Output sheet created as a separate workbook ? If it is a lot of work I can do this by copy paste daily. But was just wondering so thought it best to check.



    In any event - I am glad with the response and help. Thanks to you both. Perhaps another lesson learned to some extent can't say fully.

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

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Jason,
    I have now updated the sheet to save the output sheet in to a file.
    You said
    "Gets selected and asks me to select a cell and press enter. Why would this be happening"
    I do not think the message you are getting comes from my code. You must have other in your module which may be linked to calling other modules.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    51

    Re: Create Multiple Rows based on Cell Value by way of VBA

    Fantastic and thank you once again.

+ 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