Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    recalculate user defined function (2003)

    Hi there

    I have a worksheet which contains some user defined functions.
    In my code I would like to get the worksheet to recalculate.
    However when I use
    application.calculate

    the user defined function do not recalculate

    Any help with this would be much appreciated

    Amanda Battye

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: recalculate user defined function (2003)

    Does it help if you insert the line

    Application.Volatile

    at the beginning of the user-defined functions? This forces the functions to be recalculated whenever Excel performs a calculation.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: recalculate user defined function (2003)

    If your UDFs take arguments, they will recalculate when those arguments change. If they don't, then you need to use Application.Volatile as Hans said, or possibly redo the functions so that they do take arguments.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recalculate user defined function (2003)

    Many thanks

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recalculate user defined function (2003)

    Just to add to the comments given:

    Application.CalculateFull

    would force an entire recalculation regardless of the volatile status.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  6. #6
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recalculate user defined function (2003)

    thanks Jan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •