+ Reply to Thread
Results 1 to 8 of 8

Trying to automate "Goal Seek" in a worksheet

  1. #1
    Registered User
    Join Date
    10-22-2016
    Location
    New Jersey
    MS-Off Ver
    2016
    Posts
    20

    Trying to automate "Goal Seek" in a worksheet

    Hi - I am trying to automate the Goal Seek function in a spreadsheet such that it can either be run by a macro or automatically computed when an entry has been changed. I tried to run as a macro but the goal seek value seems like it needs to be hard coded and cannot reference a cell or be copied into the dialogue box. Any help would be greatly appreciated. TIA

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

    Re: Trying to automate "Goal Seek" in a worksheet

    Disclaimer: I have little experience with coding goal seek and/or Solver in VBA (usually I prefer to write my own root finding routines).
    but the goal seek value seems like it needs to be hard coded and cannot reference a cell or be copied into the dialogue box.
    My usual solution to this simple problem is to add a helper cell =current target cell formula - desired target value. Then Goal Seek/Solver/other root finding algorithm can be hard coded as "set target cell to a value of 0 by changing decision variable(s)." If that is the only problem you are having with your code (hard to say since you did not provide an example of any of the code you have tried), then that should solve that problem.

    If you are interested, here's a tutorial spreadsheet I created and adapted to perform root finding in Excel using Newton Raphson algorithms without any VBA http://www.excelforum.com/tips-and-t...ind-roots.html
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Trying to automate "Goal Seek" in a worksheet

    To run by a macro you'll need to strip out the absolute reference $ signs - I had luck selecting the cell after that:

    Please Login or Register  to view this content.
    Where RngDesig was the Cell Address without the $'s.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    10-22-2016
    Location
    New Jersey
    MS-Off Ver
    2016
    Posts
    20

    Re: Trying to automate "Goal Seek" in a worksheet

    Thanks for your help but not sure I understand. I am trying to find a way to automate the Goal Seek function or create a macro. Problem with the macro is that I need to copy and paste a value into the function as it does not allow reference to a cell. I tried to copy the variable and then paste into the dialogue box but it wouldn't take. Thoughts?

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Trying to automate "Goal Seek" in a worksheet

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Registered User
    Join Date
    10-22-2016
    Location
    New Jersey
    MS-Off Ver
    2016
    Posts
    20

    Re: Trying to automate "Goal Seek" in a worksheet

    Attached is the file I am working on. My goal is to get the result in AD64 that I specified in L6 by changing the value of H6 and, if possible, posting the computed value in N6. Thanks in advance for your help.
    Attached Files Attached Files

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Trying to automate "Goal Seek" in a worksheet

    This got close:

    Please Login or Register  to view this content.
    Last edited by xladept; 10-23-2016 at 03:31 PM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Trying to automate "Goal Seek" in a worksheet

    Hi mj,

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Using Goal Seek - where I want the "To Value" to be a specific cell
    By Ainsley in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2015, 06:52 AM
  2. slow "goal seek" responding time:(
    By amanda1983810 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2011, 01:20 PM
  3. Automate Goal Seek in VBA??
    By shaun2985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2009, 09:17 AM
  4. Automate Goal Seek
    By marcghannoum@gm in forum Excel General
    Replies: 6
    Last Post: 01-26-2009, 02:47 PM
  5. How to set the "to value" in GOAL SEEK as a cell reference?
    By phaidon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-10-2005, 05:45 PM
  6. updating without "goal seek"
    By fredscott in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-28-2005, 04:06 PM
  7. Automate Goal Seek?
    By John Richards in forum Excel General
    Replies: 2
    Last Post: 04-23-2005, 10: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