+ Reply to Thread
Results 1 to 3 of 3

UDF Not Woking Unless Commited Using Enter Again

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,876

    UDF Not Woking Unless Commited Using Enter Again

    Hi,

    I have a UDF that generates a String..

    Please Login or Register  to view this content.
    On Cell B4 on another sheet, I have this formula which calls the UDF and adds Text at the start and the end to generate a string that is used somewhere else -

    Please Login or Register  to view this content.
    The Only issue is, where the parameter on the source sheet changes (which affects the UDF) I need to hit enter once for the UDF to return the actual values..

    I added Application.Volatile (True) too, but does not help..

    I also noticed, If I put the parameters on the same sheet where I am trying to run the UDF, it happily works..

    Any views please?
    Attached Files Attached Files
    Last edited by NeedForExcel; 05-20-2015 at 07:25 AM.
    Cheers!
    Deep Dave

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: UDF Not Woking Unless Commited Using Enter Again

    Hello,
    Maybe by forcing Excel to recalculate when you change a value in your parameter list.
    Add this code to the ReadMe sheet :

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,912

    Re: UDF Not Woking Unless Commited Using Enter Again

    The main thing I see is that you are not passing any arguments to the function, and you have coded the function so that any information it needs is hard coded into the function. A good UDF should not get its own information from the spreadsheet. Everything it needs (such as LF and the information in column I for CellValue) should be passed to the function through the argument list.

    If you are new to coding UDF's, I would suggest a page like this: http://www.cpearson.com/Excel/Writin...ionsInVBA.aspx to get a feel for the basic ideas and "best practices" around creating a UDF.
    Last edited by MrShorty; 05-20-2015 at 11:42 AM.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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] =IFERROR not woking for me
    By Topher53180 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2014, 05:00 AM
  2. [SOLVED] Rank formula not woking
    By Fletch74 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-06-2014, 10:36 PM
  3. Woking on Excel Spaces (macro)
    By foehngreen in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-17-2011, 03:29 PM
  4. Macro in module not woking for all sheets
    By TRJJK73 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2008, 01:12 AM
  5. [SOLVED] woking with date's
    By 72shots in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2005, 09:06 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