+ Reply to Thread
Results 1 to 9 of 9

Deleting rows w/out losing references

  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    Dallas area
    Posts
    3

    Deleting rows w/out losing references

    I have a sheet of data that I'm trying to delete a row from. When I delete the row, all the rows below it change to #REF, and I guess I lose all the references to my formulas. I had a similar sheet of data that I could delete rows from without this happening, so I know it can be done, but how?
    Let me know if any further info is needed to help solve this problem.
    Thank you.
    Last edited by VBA Noob; 09-23-2008 at 02:20 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Welcome to the forum.
    so I know it can be done, but how?
    Indeed, but it depends on what the formulas are.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626
    You can attach your file here.
    I believe it will be easy to solve
    I need your support to add reputations if my solution works.


  4. #4
    Registered User
    Join Date
    09-23-2008
    Location
    Dallas area
    Posts
    3
    Quote Originally Posted by sglife View Post
    You can attach your file here.
    I believe it will be easy to solve
    Sure, here you go.
    I had to zip it up because it was too big.
    Let me know if you need anything else.
    Thank you.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626
    I have checked your formulas, there are some formulas refer to the above row, so if you delete a row, like row 15, then the row 16 will show a "#REF",
    To solve this problem, just copy the formula from row 13, and paste down to all the field
    and remember to unhide column P to column AE because there are some formulas too
    Last edited by sglife; 09-24-2008 at 02:00 AM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    sglife's approach is certainly valid if you don't mind copying formulas down after inserting or deleting a row.

    In the alternative, you can used relative named ranges, and make the sheet immune from the effects of inserting or deleting rows. As an example, A14's formula is =A13+1. If row 13 is deleted, you get a reference error.

    Select cell A14 and do Insert > Name > Define ptrAbv Refers to: =!A13 (NB: EXACTLY as shown)

    Then change the formula to =ptrAbv+1. That formula always refers to the cell directly above it, irrespective of where it appears.

    The same approach is valid for all of your references, differing slightly in the details. Post back if you need a second example.

  7. #7
    Registered User
    Join Date
    09-04-2008
    Location
    Sydney, Australia
    Posts
    9
    The other option would be to copy the area (from the line below the line you want to delete) plus one extra line, then paste over the line you wanted to delete. This way the formulas will not go to a #REF.

  8. #8
    Registered User
    Join Date
    09-23-2008
    Location
    Dallas area
    Posts
    3

    Thumbs down

    I really appreciate you guys' help.

    The ptrAabv method works great when I'm counting, but when I tried to do it with all the other cells in the row, it started giving me errors, and I really didn't want to have to make a pointer to every single cell from A to the last cell in the row, which I think was W.

    The method to cut all the rows below and paste them over the row I'm deleting works, I guess, but what if I need to add a row?
    It's frustrating because I tried to add one today, and it it's keeping the references to the cell's 2 rows above it now. I'm thinking there has got to be a better way to do this. What good would it be to not be able to add or delete rows w/out screwing up the whole sheet?

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I'm thinking there has got to be a better way to do this.
    There is, and I thought I gave you a pretty big hint. I do this more than infrequently.

    If you don't understand, please explain exactly what you tried that didn't work.

+ 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] Deleting Duplicate Rows???
    By jerickson in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-27-2012, 01:02 PM
  2. Deleting duplicate offsetting rows
    By bshbros in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2008, 05:30 PM
  3. Replies: 7
    Last Post: 06-26-2007, 11:33 AM
  4. deleting rows screws formulas
    By wombat323 in forum Excel General
    Replies: 2
    Last Post: 11-11-2006, 07:58 PM
  5. Deleting hidden rows
    By Tobeman in forum Excel General
    Replies: 2
    Last Post: 10-27-2006, 05:11 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