+ Reply to Thread
Results 1 to 3 of 3

Automatically Run Code to Insert New Row

  1. #1
    Registered User
    Join Date
    02-02-2016
    Location
    Gainesville, FL
    MS-Off Ver
    2016
    Posts
    8

    Automatically Run Code to Insert New Row

    Hi Guys,

    I have been searching tirelessly for a clear way to create a code which I can apply to my current worksheet which will AUTOMATICALLY create, or delete, a new row once a previous row is filled with new information, or cleared of existing information.

    This is necessary because I have a worksheet which serves as a meeting agenda with several topical "sections" of information e.g. "Change Orders," "Revisions," "Requests for Information," "Safety," etc. As you can imagine, the information, delineated as individual line items, associated with each section is bound to change from agenda to agenda. Therefore, to accommodate this "dynamic" range of information, it is necessary to add or delete the appropriate numbers of rows per section per week. This not only gets repetitious, but this worksheet is intended for use among my colleagues and I honestly cannot expect them to know how to add and delete rows manually.

    I capitalized automatically above because I do not want to manually run a macro. Instead, I want the code to automatically recognize the changes and make the appropriate adjustment.

    As it stands, the sections are not tables but cant be converted to tables if necessary.

    I have attached the worksheet for reference.

    P683-15 _ Agenda Body _ 003.pdf

    P683-15 _ Agenda Body _ 003.xlsx

    Thanks for your help,

    TW
    Last edited by floppygoat; 02-03-2016 at 10:10 AM.

  2. #2
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: Automatically Run Code to Insert New Row

    Floppy (it's fun to say),

    It looks like:

    A1: you want to insert an additional row anytime you type something in (any column of) the last available row between sections A & B, B & C, C & D, ... -- correct?
    A2: you want only one blank row between sections A & B, B & C, C & D, ... -- correct?

    If both of my assumptions (A1 & A2) above are correct, I propose the following solution:

    S1a: Any time ANY text is written in any column of the row that is the last available (blank) row between sections A, B, C, ...: insert another blank row.
    S1b: Any time the document is saved, closed, or opened, run a loop through the document, deleting all blank rows just before sections B, C, D, ... begin except the last blank row (if there are multiple blank rows).

    Please verify my assumptions: A1 & A2 are correct and comment on my proposed solution: S1a & S1b.
    Last edited by joe31623; 02-03-2016 at 12:40 PM.
    <---If my answer helped, please click *

  3. #3
    Registered User
    Join Date
    02-02-2016
    Location
    Gainesville, FL
    MS-Off Ver
    2016
    Posts
    8

    Re: Automatically Run Code to Insert New Row

    Joe,

    That is correct.

    However, after thinking more about it, I have come to the following conclusions:

    1. I am less concerned with too many blank rows, since blank rows are easier to delete than create, and since you may want more than one blank row to force a section to begin on a new page. Therefore, this part of the request (A2) can be disregarded. However, an option to add such a code if desired wouldn't hurt
    2. It is equally important to create a new row before the first line item each time new information is added in the "first" row of any section since new information is often added reverse chronological order. Therefore, I would like to maintain at least one blank row between the section header and the first line item of that section and at least one blank row between the last line item of that section and the next section header.

    Consider the attached spreadsheet for the following examples:

    1. If new information is added to row 11 (the row immediately below the safety section header), a new row would be inserted, maintaining a blank row at row 11, and pushing the just added information down to now row 12. This would be the same for each section.
    2. Similarly, if new information is added to row 17 (the last row of the safety section and the row immediately before the submittal section header), a new row would be inserted, maintaining a blank row at now row 18.
    3. This of course would have to work for each section and regardless of how many line items were inserted or whether they were inserted at the end or beginning of the section.



    If you have any additinal question, please let me know.

    I am grateful for your interest.

    Thanks,

    TW

+ 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] How can I automatically insert this source code into new tabs or all Tabs?
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2015, 06:42 PM
  2. [SOLVED] Excel 2010 - VBA code to automatically insert username into cell on worksheet
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-28-2015, 07:58 PM
  3. Amendment to code: automatically insert rows if needed
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2014, 11:30 PM
  4. Replies: 3
    Last Post: 11-19-2014, 02:38 AM
  5. [SOLVED] Automatically Insert Rows, slight change in code required
    By radfal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2012, 07:31 AM
  6. Code to automatically insert space in a string
    By alis88 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2012, 05:48 PM
  7. [SOLVED] automatically insert town name after entering zip code
    By accessnovice in forum Excel General
    Replies: 2
    Last Post: 07-12-2005, 05:05 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