+ Reply to Thread
Results 1 to 3 of 3

Update data by inserting/deleting new row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    137

    Update data by inserting/deleting new row

    Good morning
    I would appreciate some help to do the following:

    I have this workbook with a macro that runs in a range, lets say, ("A10:A200").
    That sheet has also a column ("B" p.e.) where rows are numbered from 001 to 190.
    These rows have formulas in several cells.

    When I insert a new row, macro copies formulas to this new row, but I dont know how to update numbering in col B.
    Also, how do I update the range ("A10:A200") when I insert/delete rows, for macro runs the new range (with more or less rows)?

    Thank you very much

  2. #2
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    137

    Re: Update data by inserting/deleting new row

    Hi
    Relative to last post, I had resolved some things, but I really need some help to solve the following:

    1st issue:
    In Row 83, for example - IF(H84<=0;0;IF(H84>0;ROW()-1+MATCH(H83;$H$10:$H$190;0)))

    When I insert a new row, this formula don't assume the sequency row (jumps the new row). I've tried to solve it with this:

    In Row 83 - IF(ROW(H83)+1>=0;0;IF(ROW(H83)+1>0;ROW()-1+MATCH(ROW(H83);$H$10:$H$190;0)))

    However, if h83+1 is 0 it returns #N/A. What's the difference or what's wrong with the second formula?

    2nd issue:
    By inserting/deleting rows, can a certain range ("A1:A200") in a certain macro be updated automatically?

    Thanks again

  3. #3
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2013
    Posts
    137

    Re: Update data by inserting/deleting new row

    Ok.

    I think I've solved 1st issue:

    In Row(D83) - =IF(INDIRECT("H"&ROW()+1)<=0;0;IF(INDIRECT("H"&ROW()+1)>0;ROW()-1+MATCH(H83;INDIRECT("H"&ROW()+1):H$190;0)))

    When I run macro to insert new row (Row 84 will be created), formula is created correctly without jumping the new row:

    In Row(D84) - =IF(INDIRECT("H"&ROW()+1)<=0;0;IF(INDIRECT("H"&ROW()+1)>0;ROW()-1+MATCH(H84;INDIRECT("H"&ROW()+1):H$191;0)))

    It returns #N/A on "D84" but if I put data in the new "H84" formula will be well executed.

    If I delete a row in that range, it works fine too.

    Now the 2nd issue is harder enough, because I need to change VBA code to get automatic update for range ("A1:A200"). What I really need is if I insert a new row Range must update to ("A1:A201") and so on.

    Is there a good way to do that?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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