+ Reply to Thread
Results 1 to 6 of 6

excel stepping into UDFs when changing links

  1. #1
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    excel stepping into UDFs when changing links

    I have the following macro
    Please Login or Register  to view this content.
    which if I do manually through edit links works fine but when I run it as a macro and F8 through it it gets to "ActiveWorkbook.ChangeLink vLink, ThisWorkbook.Name, xlExcelLinks" and then tries to run through the addins UDFs but with no values and it crashes out.
    e.g. one of my UDFs is
    Please Login or Register  to view this content.
    and it will start stepping through this with the input variables being location = error 2015 & mass = 2023

    what is excel trying to do?

    If I expand the variables in locals it looks as if excel upon changing the link in the first cell tries to recalculate it however it hasn't yet updated the links in the second cell (which is an input in the first cell) and falls over.

    does the link change go through 1 cell at a time and trigger calc manual on each cell change? but then you does this not fall over when using the edit ribbon edit links button (as it is the UDF that is falling over from this)? is there a way to totally disable calculations temporarily to get around this?

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: excel stepping into UDFs when changing links

    your udfs ought to have error handlers in them and test for empty/error inputs: http://www.decisionmodels.com/calcsecretsj.htm
    if a code error occurs while running vba code it's a runtime error; if it occurs due to excel's code running you should just get an error returned to the cell (which may subsequently be recalculated)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: excel stepping into UDFs when changing links

    Is there a way to do it without using
    Please Login or Register  to view this content.
    ?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: excel stepping into UDFs when changing links

    you can just use On Error Resume Next if you don't want to code properly ;-)

  5. #5
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: excel stepping into UDFs when changing links

    isn't using On Error in itself not coding properly? as you are not using an if then statement to prevent an error you are just dealling with an error if one arrises.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: excel stepping into UDFs when changing links

    not all errors are preventable and on error is the only option available in vba. of course you should ideally try and avoid errors altogether but in some situations even if you can do that it is more practical to simply trap/hide errors

+ 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. Excel Changing Links
    By kingdt in forum Excel General
    Replies: 1
    Last Post: 01-28-2012, 01:03 PM
  2. Changing Links in Excel
    By a-5er in forum Excel General
    Replies: 1
    Last Post: 08-14-2011, 10:41 AM
  3. Edit Links: Changing links on a protected worksheet
    By Halibut68 in forum Excel General
    Replies: 0
    Last Post: 04-28-2006, 06:10 AM
  4. [SOLVED] My links in excel keep changing when adding another link?
    By JessicaHam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2005, 04:05 PM
  5. [SOLVED] Changing links in many excel files.
    By cghall55 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2005, 02:05 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