+ Reply to Thread
Results 1 to 16 of 16

Macro to remove cell reference to another worksheet and external links

  1. #1
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Macro to remove cell reference to another worksheet and external links

    Dear Friends,

    I have 2 worksheets (sheet A and sheet B)

    Sheet B contains formula linking to sheet A.
    (e.g In sheet B
    B1 = 'Sheet A'!C1 (10)
    B2 = 'Sheet A'!C2 (20)
    B3 = B1 + B2

    Is there a macro which will remove reference of another sheet ?
    e.g In sheet B
    B1 = 10
    B2 = 20
    B3 = B1 + B2

    Also, Is there a macro which will remove reference of another workbook. ?

    I have many worksheets with numerous links.
    I would like to remove the links of particular sheet only. Its very time consuming to find the reference and then do "copy paste special"

    I want a macro to remove all the references and links in the selected sheet.

    Please assist.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Macro to remove cell reference to another worksheet and external links

    How about copy paste special for the whole worksheet?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    Quote Originally Posted by oeldere View Post
    How about copy paste special for the whole worksheet?
    That would replace the formula in B3 as well!

    Also, Is there a macro which will remove reference of another workbook. ?
    Do you want to break the external link, but keep the formula (referring to the same sheet and range in the existing workbook), or convert the cell to value?

  4. #4
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    I want to break the external references/links only.
    Formula referring to the same sheet should not be touched. It will remain as formula only.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    Save a backup copy of your file, then try this.

    To break links to other workbooks

    https://support.office.com/en-gb/art...5-f4fdb1442748

    To break links to other sheets in the same workbook

    Please Login or Register  to view this content.
    The code will ask you to 'enter criteria' which should be the name of the sheet to search for in the formulas.

    Does that do what you need?
    Last edited by jason.b75; 08-27-2016 at 04:33 AM.

  6. #6
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Jason,

    Thanks for reply.
    But sorry. Macro is not serving my purpose.

    I do not want any pop massage asking for the criteria.
    I just want the macro to break all the links in the sheet. (be it links from another sheet or links from another workbook)
    Formula referring within the sheet should remain as formula.

    Please assist

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    Quote Originally Posted by lalaarif1 View Post
    I would like to remove the links of particular sheet only.
    I based the code on what you asked for, "particular sheet" implies that there could be multiple sheets but you only want to remove links to one.

    This code will not be selective, any formula containing the ! character will be converted to value.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Wow ....

    Thanks a lot. You made my day. Macro is working fine.

    God bless you.

  9. #9
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Jason,

    Can I also have macro which will break all the links in the workbook (be it links from another sheet or links from another workbook)?
    Formula referring within the sheets should remain as formula.

    In my file, there are 40 sheet.
    Sometime I need to break links of only few sheets and sometimes all the sheets.

    Please assist.

  10. #10
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Jason,

    I want following option also.
    Is there a possibility in macro which displays names of all the sheets as pop up.
    Then I can select the sheets where links need to be removed.

    Please assist.

  11. #11
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    Try this one

    Please Login or Register  to view this content.
    If you have a lot of formulas then it could take a while.

    The link that I provided in post #5 shows you how to break the links to other workbooks with a couple of mouse clicks, so that might be quicker than running the macro.

  12. #12
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Macro is showing debug error.

    Also let me know what criteria i need to give in pop up (refer post 5) and how the macro will work.

  13. #13
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    If that is happening then I would guess that some sheets don't have any formulas at all.

    This should fix that, also added in a bit of a speed boost.

    Please Login or Register  to view this content.

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    Quote Originally Posted by lalaarif1 View Post
    Also let me know what criteria i need to give in pop up (refer post 5) and how the macro will work.
    Forget the macro there, follow the link and then the instructions under the heading 'Break a link'.

    You only need to do this if you have a lot of links to other workbooks and the macro is too slow.

  15. #15
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    270

    Re: Macro to remove cell reference to another worksheet and external links

    Thanks a lot.

    Macro is working fine.

    Sorry to bother u again.

    Is there a possibility in macro which displays names of all the sheets as pop up.
    Then I can select the sheets where links need to be removed.

    I tried using macro of post 5. I could not understand it.

    Please assist.

  16. #16
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Macro to remove cell reference to another worksheet and external links

    That could start getting a bit messy, as an alternative, this variation of the code should only run on the selected sheets. (select multiple sheets by holding Ctrl and clicking the tabs).

    Keep the previous version so you can run it on all sheets without selecting them first if you need to.

    Please Login or Register  to view this content.
    Is that adequate?

+ 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 remove external links from formulas
    By Thomas Andrews in forum Excel General
    Replies: 2
    Last Post: 06-10-2014, 03:38 AM
  2. Completely remove/delete all the external links (Break Links)
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 05:31 AM
  3. Replies: 2
    Last Post: 08-04-2012, 11:28 AM
  4. External reference links
    By Jonnyk in forum Excel General
    Replies: 0
    Last Post: 03-17-2011, 04:25 PM
  5. [SOLVED] Reference external worksheet whose name is in a cell
    By Poly4 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2006, 10:15 PM
  6. [SOLVED] Using cell value to reference external worksheet?
    By tsobiech in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2006, 11:15 AM
  7. [SOLVED] best way to remove external links
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 12-21-2005, 04:10 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