+ Reply to Thread
Results 1 to 9 of 9

How to insert different number of rows and drag values from the row before inserted?

  1. #1
    Registered User
    Join Date
    05-05-2016
    Location
    Zurich
    MS-Off Ver
    2010
    Posts
    12

    How to insert different number of rows and drag values from the row before inserted?

    Dear Excel experts,

    could you please help me in a macros that would do the following:

    1. I have a table 52-cell long and 915-cell wide.
    2. Starting from row 2, I need to insert (A3-A2)*17 number of rows after row 2 and drag the same values in all inserted rows from row 2.
    3. Go to the next row and insert again (A4-A3)*17 (row numbers will be larger due to inserting row in the previous step) and drag the same values in all inserted rows from row X (X is next row after the last inserted row in step 2.)
    and then repeat until the last row.

    Thanks a lot for your help!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: How to insert different number of rows and drag values from the row before inserted?

    After you insert rows based on row 2, are A4 and A3 the new A4 and new A3, or the old cells prior to the insertion?
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-05-2016
    Location
    Zurich
    MS-Off Ver
    2010
    Posts
    12

    Re: How to insert different number of rows and drag values from the row before inserted?

    Dear Bernie,
    after inserting rows based on row 2, A4 and A3 moves down to the row that follows after inserted rows, so they are not A4 and A3 anymore. The number of rows to insert is different in each 52 times of inserting and the values to insert in each "row set" is different and should be taken from the row located before row inserting. If any further info is needed, please let me know.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: How to insert different number of rows and drag values from the row before inserted?

    Whenever you are inserting or deleting rows, it is best to work from the bottom up, so try this:


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-05-2016
    Location
    Zurich
    MS-Off Ver
    2010
    Posts
    12

    Re: How to insert different number of rows and drag values from the row before inserted?

    Yes, it works.
    How can I adjust the code so that the number of inserted rows is multiplied by 17 (for example, (A3-A2)*17 for the first inserting?
    Thanks a lot!!

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: How to insert different number of rows and drag values from the row before inserted?

    Sorry - forgot about that part.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-05-2016
    Location
    Zurich
    MS-Off Ver
    2010
    Posts
    12

    Re: How to insert different number of rows and drag values from the row before inserted?

    Dear Bernie,
    thanks a lot, it works.
    I tried to do the multiplication in "i=..." part, but get an error. Now I see where you put it properly. Thanks!

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: How to insert different number of rows and drag values from the row before inserted?

    You could have done it there, too:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-05-2016
    Location
    Zurich
    MS-Off Ver
    2010
    Posts
    12

    Re: How to insert different number of rows and drag values from the row before inserted?

    Ah, ok, I did not include ".Value" inside the brackets. Thank you.

+ 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. How to auto insert values inserted on another worksheet
    By acerlaptop in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-20-2014, 08:19 AM
  2. Replies: 0
    Last Post: 05-10-2013, 12:04 PM
  3. Replies: 2
    Last Post: 07-13-2012, 03:21 AM
  4. Automatically Insert Columns as a Result of Inserted Rows
    By The Exceller in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-01-2012, 09:35 AM
  5. Insert row, modify original & inserted rows
    By 1cor1_27 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2011, 05:00 PM
  6. how to insert non sequential rows based on inserted data?
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-18-2010, 11:51 AM
  7. [SOLVED] automatically insert formula when new rows are inserted
    By BLUEJAY in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-27-2006, 05:30 AM

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