+ Reply to Thread
Results 1 to 7 of 7

macro that will insert rows base on a cell value

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Post macro that will insert rows base on a cell value

    Hello to all,


    I am a newbie in excel macros and i do create macros by just recording. Need to create a macro that will insert number of rows below a cell base on its value, then copy a range of data in a row and paste it on those rows.
    Attached is the sample file with two tables. The table below is the one i want to accomplish. thank you for your help.

    table.png
    Last edited by dedeng; 10-14-2012 at 03:09 AM.

  2. #2
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: macro that will insert rows base on a cell value

    Try
    Please Login or Register  to view this content.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  3. #3
    Registered User
    Join Date
    10-09-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: macro that will insert rows base on a cell value

    Wow it works! Thanks. Is there a way to separate contents of cell (column F, LOCATION) into separate row. Sorry its my bad, i didln't specify it in my post.

    thank you

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: macro that will insert rows base on a cell value

    Quote Originally Posted by dedeng View Post
    Wow it works! Thanks. Is there a way to separate contents of cell (column F, LOCATION) into separate row. Sorry its my bad, i didln't specify it in my post.
    thank you
    Sorry but I am not sure exactly what you are asking for. Please can you elaborate or preferably upload a copy of your workbook with a before and after sheet (obviously remove any confidential info).

  5. #5
    Registered User
    Join Date
    10-09-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Smile Re: macro that will insert rows base on a cell value

    Sorry for my vague questions . Attached is a sample file with 2 sheets <before> and <after>. Data in sheet <before> column "F" were badly encoded.Each ITEM should be encoded in separate row. Like data in cell "F3" which is "U30,31,33,35,36" should be encoded "U30" in cell F3, "U31" in cell F4, "U33" in cell F5, "U35" in cell F6 and "U36" in cell F7. Data in cell "F7" which is "C5, 7-9" is actually "C5,C7,C8,C9" and that "19-25 in cell F10 is actually C19,C20,C21,C22,C23,C24,C25" and should be encoded or inputted in separate rows in column F (see sheet <after>).

    Actually this is a text file converted or opened in excel, used the delimited option and saved as excel file.

    thank you
    Attached Files Attached Files

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: macro that will insert rows base on a cell value

    Give this a try

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  7. #7
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: macro that will insert rows base on a cell value

    Mike, I must say I think that is a very nice piece of coding

+ 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