+ Reply to Thread
Results 1 to 4 of 4

Insert Rows on Criteria and Copy content to Specific Cells in New Rows(Tables)

  1. #1
    Forum Contributor
    Join Date
    04-23-2014
    Location
    Liverpool...ish
    MS-Off Ver
    Excel 2013
    Posts
    126

    Insert Rows on Criteria and Copy content to Specific Cells in New Rows(Tables)

    Hello All,

    I have two problems that I am trying to address in this example.

    I am inserting new rows based on the Countif function in column G. What I have now correctly identifies column G and adds the number of Rows it says. That much is good...sort of. What I need however is to calculate (G -1). That is, I need to have however many rows in the Countif including the current one. Dense I am it would appear but I just can’t get it done. The closest did what I wanted but any countif of 1 created an error.. now I can't even remember how I did that!

    The second thing that I need is to copy the contents of Column A only to the new rows.

    Thanks
    Scott

    For your viewing pleasure:Add a row.xlsm

  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: Insert Rows on Criteria and Copy content to Specific Cells in New Rows(Tables)

    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 Contributor
    Join Date
    04-23-2014
    Location
    Liverpool...ish
    MS-Off Ver
    Excel 2013
    Posts
    126

    Re: Insert Rows on Criteria and Copy content to Specific Cells in New Rows(Tables)

    So close yet so far away. I had to have been some silly symbol away from having it.

    Anyway, It works well. At first, for some reason, it wouldn’t process any CountIif value of 1 as I had encountered except it just ended the sub when it encountered the first ‘1’ rather than giving an error, so I played with it, eventually ended back up with your original code and it worked. Mysteries never end. Anyway, it plays well with dates and formats and copies multiple disconnected columns as it should.

    Thank You for saving me my last strand of hair… I’ll need it for the next problem
    Scott

  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: Insert Rows on Criteria and Copy content to Specific Cells in New Rows(Tables)

    You're welcome and thanks for the rep!

    I don't know why a routine will finally work even the code seems to be the same as what had previously failed - egregors perhaps??

+ 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. Copy rows and insert data if criteria is met ?
    By wuf_1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-05-2014, 05:37 AM
  2. Copy specific rows to another tab depending on content.
    By Jeffro2p in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2014, 04:54 PM
  3. [SOLVED] Insert rows based on the current cell value and, then, copy some cells into the new rows
    By Excel-RZ in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-03-2013, 05:19 PM
  4. [SOLVED] Macro/VBA to Change Order of Rows/Add Rows based on specific text content presence/absence
    By cmaunder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2013, 04:50 PM
  5. Replies: 0
    Last Post: 03-06-2013, 05:44 PM

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