+ Reply to Thread
Results 1 to 6 of 6

How to replace a sheet that has formulas linked to it, without REF-errors?

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    How to replace a sheet that has formulas linked to it, without REF-errors?

    Hi! The issue is the following:
    I have a workbook with several sheets. One of them contains a central table with data, "Depoes". On several other sheets I have formulas that is connected to the sheet "Depoes".
    What I am trying is to do, with VBA, is to DELETE the sheet "Depoes", and then replace it with a NEW copy, from "THE MASTER WORKBOOK", where the sheet "DEPOES" is updated.

    The sheet removal, and retreival of a new copy is working fine. The issue is the formulas, they don't like it, when the sheet "Depoes" is deleted, so I get "REF-errors".

    I tried to replace the "Equal sign" in the formulas with the "fool-proof-code" of "ZZZXZZZ", before doing the deletion and retreival of the new copy, but using REPLACE in VBA, after that, replacing
    "ZZZXZZZ" with "=" will NOT work......probably since I am trying to create a formula out of a string......

    Anybody has any ideas?

    Best Regards from Sweden
    Bj顤n

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to replace a sheet that has formulas linked to it, without REF-errors?

    Here's one idea. First rename the existing sheet to something like "Depoes OLD". Excel will automatically change all your formulas to reference this name. Then add the new, updated Depoes sheet. Now do a global Find & Replace in your formulas to change "Depoes OLD" to "Depoes". Now delete sheet "Depoes OLD". This can all be done in VBA; it sounds like you may already have the VBA skills to know how.

    If you need more detailed help then it would be useful to attach your file.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: How to replace a sheet that has formulas linked to it, without REF-errors?

    Thx M8! I will give it a go, sounds good!

  4. #4
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: How to replace a sheet that has formulas linked to it, without REF-errors?

    Hi ! Problems solved! Thx!
    Another question in the same area.....regarding the retreival of the tab from the master Worksheet that I described above.....
    The master worksheet is on a Sharepoint-sight and the code that I have works sometimes, and sometimes it doesn't...... :-(
    When It doesn't work, it always stays at the same line....with a "Subscript out of range"-error.....which is a natural error, since the retreival hasn't kicked in.....

    I enclose the code below......the part that doesn't work is when the sharepoint-worksheet shout be found, and opened.....the code DOESN'T find it somestimes....and sometimes it does.....???
    (That part is on the row "directory........."
    Is there somethisn special I need to do, to get the code to really search the adressed folder.....the file IS present.....any special references I need to set? Or...?

    Please Login or Register  to view this content.
    Best Regards!
    Bj顤n

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to replace a sheet that has formulas linked to it, without REF-errors?

    I have no experience in using VBA to work with files over a network or with SharePoint. I don't know why this problem is occurring, and not sure how to troubleshoot. But this question is so completely different than your first question, you might get better help if you start a new thread with a title like

    Intermittent error with workbook opened from SharePoint

  6. #6
    Registered User
    Join Date
    05-12-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: How to replace a sheet that has formulas linked to it, without REF-errors?

    You're so right.....thanx!!

+ 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. Replace Sheet Name in Formulas with Name from list of Sheet Names - Macro
    By jgray in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-17-2013, 01:25 PM
  2. need to create a macro to replace manual formulas with errors
    By mrmvr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-15-2012, 11:43 AM
  3. Errors in my formulas in sheet 1 when deleting data in sheet 2
    By Sucha304 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2012, 02:22 AM
  4. Replies: 5
    Last Post: 01-24-2012, 08:54 PM
  5. replace #﹕EF! errors within formulas
    By dvb_24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-02-2011, 05:22 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