+ Reply to Thread
Results 1 to 9 of 9

Deleting strings from formulas

  1. #1
    Registered User
    Join Date
    10-11-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    5

    Deleting strings from formulas

    I have an Excel workbook that references a custom add-in located on a users C drive. However, if a user opens this workbook from a shared network drive (W drive for example) instead, the workbook then looks for the add-in on the W drive and can't locate it, resulting in a bad path name in the formula bar and a #NAME? error in the cell.

    Ex:

    ='W:\Path\Path\AddIn.xla'!ABCFunction($D$9,$B$5,$B$6,$B$7,"hours", 0)

    ...where 'W:\Path\Path\AddIn.xla'! needs to be removed for the function to work properly.

    This can be fixed by doing a simple find/replace of the offending link in the formula bar, but I'm looking for a way to automate this process. Because there are multiple shared network drives this workbook might be opened from, I can't use a simple ChangeLink function because the path will change depending on which drive it is opened from.

    I need a way to either find any characters in between the = and ABCFunction and delete them, or a way to find any link's ending in .xla and delete.

    Any help would be greatly appreciated.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting strings from formulas

    Easily done.

    Please provide Workbook and worksheet names

  3. #3
    Registered User
    Join Date
    10-11-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Deleting strings from formulas

    Well it's not just one workbook in particular, there are multiple that have this same issue. I was just thinking of using an ActiveWorkbook call.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting strings from formulas

    Ok so you will save the macro in your personal folder so it is always available.

    How will you ensure that it isn't run on the wrong worksheets? or do the strings only occur on the sheets that you want modified?

  5. #5
    Registered User
    Join Date
    10-11-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Deleting strings from formulas

    I was just going to copy/paste the code under the Private Sub Workbook_Open() method for each workbook I need modified.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting strings from formulas

    ok

    I will be 5 minutes.

    BRB

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting strings from formulas

    Ok

    Try This code.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-11-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Deleting strings from formulas

    Thank you for the reply!

    I tried this code and got an error saying "You cannot change part of an array". I probably should have mentioned these formulas are all within an array.

  9. #9
    Registered User
    Join Date
    10-11-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Deleting strings from formulas

    Which object/procedure should this go under? I want this to run when the workbook is opened without any additional users interaction. That's why I initially had it under Private Sub WorkBook_Open().

+ 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] Counting and formulas with text strings
    By phillyfilly in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-08-2012, 07:03 PM
  2. Help with strings & formulas
    By daisydaisy in forum Excel General
    Replies: 9
    Last Post: 12-25-2010, 02:48 PM
  3. Macro help deleting rows with selected character strings
    By rliccion in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2009, 01:45 PM
  4. deleting rows containing certain strings
    By pilch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2008, 05:23 AM
  5. [SOLVED] deleting values in a worksheet without deleting the formulas
    By patti in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-28-2005, 05:05 PM

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