+ Reply to Thread
Results 1 to 8 of 8

Kindly fix the Function "HagedornBrown"

  1. #1
    Registered User
    Join Date
    02-15-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Kindly fix the Function "HagedornBrown"

    Hi,
    I'm a new user of the Excel VB. Below is a code I'm writing. I intend to call it from a spreadsheet.
    So far, all the functions are ok except for the last one- HagedornBrown.

    Kindly review it and fix the error. Additionally, someone in the house can also advise me on how I can improve.

    Like I said, I'm a beginner; however, I'm keen on improving my skills.
    Thank you all.

    Regards,

    Cee


    Please Login or Register  to view this content.

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

    Re: Kindly fix the Function "HagedornBrown"

    Kindly review it and fix the error. Additionally, someone in the house can also advise me on how I can improve. Like I said, I'm a beginner; however, I'm keen on improving my skills.
    If we fix the error for you, you are not going to improve. Let's talk about debugging skills.

    1st. When you say that the function doesn't work, what does that mean? It fails to call? It runs but returns incorrect values? Any error messages?

    One of the most useful debugging tools I've found for debugging functions is setting a break point and using break mode. http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx I will usually set the first breakpoint at the function statement itself. Then, go into the spreadsheet and type =functionname(arglist). If the function call is successful, I will end up in break mode at the function statement before anything has happened. I can then add watches to the watch window to see if the arguments were passed to the function correctly.

    If the function call fails (#Value# error comes up in the cell and I don't end up in break mode). That suggests a major syntax error preventing the function from compiling. Go through the code and check for syntax errors (name conflicts, etc.).

    I would also suggest putting terms like "debugging tools", "watch window", "break mode" into your VBA help search engine and become familiar with these tools.

    Let's try that much and see where that gets you.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    02-15-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Kindly fix the Function "HagedornBrown"

    Quote Originally Posted by MrShorty View Post
    If we fix the error for you, you are not going to improve. Let's talk about debugging skills.

    1st. When you say that the function doesn't work, what does that mean? It fails to call? It runs but returns incorrect values? Any error messages?

    Let's try that much and see where that gets you.
    Hi MrShorty,
    Your message was well received.
    Unfortunately, I'm hard-pressed with time. Nevertheless, I will do as you've advised.

    I've checked for any name conflicts; however, I keep receiving the error message is #VALUE!

    Please, go ahead and see if you can identify the error, while I also try to fix it on my own. Thank you for your patience.

    Regards,
    Cee

  4. #4
    Registered User
    Join Date
    02-15-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Kindly fix the Function "HagedornBrown"

    I've done as you advised. Sadly, I couldn't get it fixed.
    It returns the error msg #VALUE!

    Pls assist

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

    Re: Kindly fix the Function "HagedornBrown"

    I don't have access to Excel, so I really am not in a position to debug this for you. Did you try setting a break point on the function statement so you could enter break mode? At this point, we need to identify which statement is creating the error, which will be easiest from within break mode.

    Another strategy I have used is to comment out all of the computations except the first one. Then set the function to return this computation. If the function works as expected, then add the second statement (updating the return value to the most recent calculation), and continue adding statements until the statement creating the error get added. This looks like
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-15-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Kindly fix the Function "HagedornBrown"

    Quote Originally Posted by MrShorty View Post
    Did you try setting a break point on the function statement so you could enter break mode? At this point, we need to identify which statement is creating the error, which will be easiest from within break mode.

    Another strategy I have used is to comment out all of the computations except the first one.
    Thank you MrShorty,
    The problem is I still do not understand how to set a break point (since I'm new to writing codes), else I would have explored that option. I can try the alternative strategy you've suggested.
    Again, thank you. I shall send you a feedback.

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

    Re: Kindly fix the Function "HagedornBrown"

    In my version of VBA, with the cursor somewhere in the desired statement, press F9. The statement should be highlighted in Brown indicating that a breakpoint has been set for that statement. press F9 again to cancel the breakpoint.

  8. #8
    Registered User
    Join Date
    02-15-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Kindly fix the Function "HagedornBrown"

    Quote Originally Posted by MrShorty View Post
    In my version of VBA, with the cursor somewhere in the desired statement, press F9. The statement should be highlighted in Brown indicating that a breakpoint has been set for that statement. press F9 again to cancel the breakpoint.
    Hi MrShorty,

    CODE FIXED! I AM IMMENSELY GRATEFUL!
    THANK YOU

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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