+ Reply to Thread
Results 1 to 4 of 4

User Defined Function

  1. #1
    Registered User
    Join Date
    01-16-2009
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    2

    User Defined Function

    Hello all! I downloaded code to run the "bisection method" on a continuous function. However, it is hard coded for a specific equation. Is there any way that i can use a cell for a user to input his/her function f(x) = xxxxxx, then run the sub to iterate for the root?

    Here is an example of how the function is hard coded (see bold at the bottom). This is a little user unfriendly, because the person using this would have to open VBE and manually change the function each time. I would like for the user to enter the function in a specific cell, and then run the sub. How can i pass the function input by a user into a cell to the sub? Thanks in advance!
    Please Login or Register  to view this content.
    Last edited by royUK; 01-29-2009 at 01:21 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User Defined Function

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    I will add them this time, but take the ime to read the Forum Rules.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: User Defined Function

    Hi,

    Assuming the function is in a cell as a string, and you may have to impose some discipline on the formatting, you could either have some helper cells, (probably hidden) to slice it up with the string slicing functions, then read each of these cell elements into VBA Variables and rebuild the f00 function.

    Alternatively read the single cell string function into VBA and slice it up and reconstitute it as a maths function within VBA.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: User Defined Function

    I would like for the user to enter the function in a specific cell,
    Maybe like this:
    Please Login or Register  to view this content.
    Last edited by shg; 01-29-2009 at 02:28 PM. Reason: cleanup
    Entia non sunt multiplicanda sine necessitate

+ 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