+ Reply to Thread
Results 1 to 3 of 3

Macro to insert rows with copied text a certain amount of times based on a value in a cell

  1. #1
    Registered User
    Join Date
    09-20-2017
    Location
    Erie,PA, USA
    MS-Off Ver
    MS Office 2016
    Posts
    7

    Red face Macro to insert rows with copied text a certain amount of times based on a value in a cell

    I am very new to VBA coding and am just learning the basics now, any direction is appreciated. I currently have an excel file with a table (Shown below) that has 3 columns.

    Site____Org Chart Titles______________________Headcount
    BAT____Tooling Coordinator______________________8
    BAT____Business Leader_________________________1
    BAT____Tooling Machinist________________________2
    CVG____Technician_____________________________32
    CVG____Advanced Deployment Technician___________1
    CVG____Business Leader_________________________1
    CVG____Chief Inspector__________________________1
    CVG____Customer Support Planner_________________3
    CVG____Engineering Specialist____________________1
    CVG____Material & Logistics Coordinator____________2
    CVG____NDT Operator__________________________1
    CVG____Office Manager_________________________1
    CVG____Production Leader_______________________1
    CVG____Quality Manager_________________________1
    DFW____Technician_____________________________32
    DFW____Advanced Deployment Technician___________1
    DFW____Business Leader_________________________1
    DFW____Chief Inspector_________________________1
    DFW____Customer Support Planner________________3
    DFW____Engineering Specialist____________________1
    DFW____Material & Logistics Coordinator____________2
    DFW____Office Manager_________________________1
    DFW____Production Leader_______________________1
    DFW____Quality Manager________________________1
    DFW____Tooling Machinist________________________2


    I need a code that will see the number in the 3 column (headcount) and add that many rows below the original - 1 with the data from the first two columns being duplicated in the added rows. So I have the amount of rows total with the same text as the number listed in the third column. For example the first 3 rows from original data need to look as follows:

    Site____Org Chart Titles______________________Headcount
    BAT____Tooling Coordinator_______________________8
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Tooling Coordinator
    BAT____Business Leader_________________________1
    BAT____Tooling Machinist_________________________2
    BAT____Tooling Machinist


    I really appreciate any help with this macro that anyone can provide!

    **Sorry for the weird formatting had trouble pasting in table**
    Last edited by rhendrickson11; 09-20-2017 at 03:18 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert rows with copied text a certain amount of times based on a value in a

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to insert rows with copied text a certain amount of times based on a value in a

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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 to Copy/Insert Copied cells based on user input # of rows/formatting rules
    By gaker10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2015, 11:42 AM
  2. Replies: 4
    Last Post: 12-10-2014, 08:47 PM
  3. Insert Number of Rows based on value within a cell... multple times
    By nyiballs in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-18-2013, 10:46 AM
  4. [SOLVED] Insert Copied Cells multiple times, shift cell down
    By system in forum Excel General
    Replies: 18
    Last Post: 09-21-2012, 12:47 AM
  5. Insert Copied Cells multiple times, shift cell down
    By system in forum Excel General
    Replies: 1
    Last Post: 09-08-2012, 10:49 PM
  6. [SOLVED] Macro based on User input to Insert X amount of rows - Need advanced help
    By BuzzOffSweetheart in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2012, 07:06 PM
  7. Replies: 0
    Last Post: 05-18-2012, 11:18 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