+ Reply to Thread
Results 1 to 4 of 4

Automatic Add of Rows Depending on Cell Value

  1. #1
    Registered User
    Join Date
    12-15-2006
    Posts
    64

    Automatic Add of Rows Depending on Cell Value

    I'm a health insurance agent trying to get our company forms to comply with the new requirements of the ACA. For the first time, the insurers need information about enrolling dependent children. Instead of just the number of them, insurers need DOB and gender too for each child.

    We try to keep it simple for our customers so just providing us with a census from which to quote isn't difficult (or, we wouldn't hear from them again). So, rather than produce a spreadsheet with as many as 10 child columns which would be quite wide I'd prefer to have the spreadsheet just insert extra rows when the number of children for a particular enrolling employee is specified on the form and is neither a blank nor a zero nor more than 10.

    Here's a sample spreadsheet where the first row was filled in and then the operator typed the number 3 into the number of children cell with the automatic insertion of three rows for the children's information and the other rows being pushed down.

    I'd also like it to add the labels Child 1, Child 2, etc.

    How would I do this in Excel?

    Thanks,

    LF
    Attached Files Attached Files

  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: Automatic Add of Rows Depending on Cell Value

    Hi Long,

    Try this code in the Sheet module:

    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
    Registered User
    Join Date
    12-15-2006
    Posts
    64

    Re: Automatic Add of Rows Depending on Cell Value

    Didn't know about the cool reputation thingie. I'll certainly use it.

    Don't know much about VBA so will be a few days before I can learn enough to use the code. But I'll devote the weekend to a book on it, I guess.

    Thanks so much.

    Best,

    David

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

    Re: Automatic Add of Rows Depending on Cell Value

    Hi Long,

    I saw that you had 62 posts so assumed that you knew how to use the code:

    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Press ALT + F11 to open the Visual Basic Editor.

    Save your Workbook As Macro-Enabled

    Double-Click on the "appropriate sheet”

    Type "Option Explicit" then paste the code under it

    And, you should be ready to go

+ 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. [SOLVED] Insert multiple rows depending on cell value
    By AR-51 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2013, 04:18 AM
  2. Sum of rows depending on the adjacent cell
    By cheftt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-06-2012, 09:50 AM
  3. Deleting rows depending on cell value
    By johnson1421 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 03:42 PM
  4. Add a number of rows depending on the value in a cell
    By ianjw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2010, 10:37 AM
  5. Repeat rows depending on a certain cell value
    By abokhadiga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2010, 05:13 AM

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