+ Reply to Thread
Results 1 to 7 of 7

Automatic Goal Seek That References Cell For Target Value

  1. #1
    Registered User
    Join Date
    01-14-2016
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    2

    Automatic Goal Seek That References Cell For Target Value

    I am trying to create a VBA code that does two things: automatically runs goal seek to update as inputs change, and references a cell containing a formula for the target value.

    I want to:

    Set cell I24
    To the value that is shown in cell G9 (which contains a formula, and the value in the cell will change as other inputs change)
    By changing cell F24

    Any help on a VBA code that would accomplish this?

    Thank you!

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Automatic Goal Seek That References Cell For Target Value

    Welcome to the forum!

    If you can attach a file and show what your manual run's results were, we can then work on the automation. To attach a file, click the Go Advanced button in lower right of a reply. Click the paperclip icon in the toolbar and Browse and Upload the file.

    Goalseek and solver can be similar. See these examples and links to get you going. Once the file is added, code can be added to run a routine if the cell I24 is changed.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-14-2016
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Automatic Goal Seek That References Cell For Target Value

    Redemptions.xlsm

    Thank you for your help. The file is attached.

    By way of background, a corporation is trying to buy back some stock held by two shareholders to arrive at target stock ownership percentages after the stock redemptions. The target stock ownership percentages are subject to change, which is why I'd like the Goal Seek-type function to run automatically. Again, the target value is also a cell that will be changing and is not a static value.

    I have not run goal seek in the attached cell yet so you can see what I'm trying to accomplish. I'd like to redeem enough stock from Shareholder C so that his ownership percentage after the redemption equals his target ownership percentage shown above in cell G9. Once the spreadsheet determines how much stock to redeem from Shareholder C, the formulas are set to figure out how much to redeem from Shareholder D.

    Thank you for your help!
    Last edited by Navigator16171; 01-14-2016 at 06:19 PM.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Automatic Goal Seek That References Cell For Target Value

    To run GoalSeek automatically you could probably use the Private sub Worksheet_Change event. But as you seem to wish that GoalSeek should run when the value in G9 changes and as G9 contains a formula this requires a somewhat different approach. I think doing it this way should work.

    Start by right clicking the tab on sheet1 and select “View code”

    To the left you see under “Microsoft Excel Objects” an number of sheets and “ThisWorkbook”

    Right click on “ThisWorkbook” and click “View Code”. In the windows that opens paste this code

    Please Login or Register  to view this content.

    Then right click on Sheet1 and click “View Code”. In this window you paste this code

    Please Login or Register  to view this content.
    Save the workbook, close it. Open it again an make a change that should give you a changed value in G9 and see if GoalSeek fires.

    Alf

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Automatic Goal Seek That References Cell For Target Value

    Please Login or Register  to view this content.

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

    Re: Automatic Goal Seek That References Cell For Target Value

    I have a similar problem to what has been discussed here. I am trying to automate one way or another the Goal Seek function in a spreadsheet such that it can either bur run by a macro or 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

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Automatic Goal Seek That References Cell For Target Value

    Hi

    Welcome to the forum but ........

    I have a similar problem to what has been discussed here.
    as forum rule #2 says that

    Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread. You may include up to 3 links to other URLs in a single post, no more, so only link to the relevant pages.
    So start a thread on your own and most likely a member will help you. And by the way a "new" thread attracts more attention then an "old" with several postings.

    Alf

+ 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. Automatic goal seek program
    By calltobala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2015, 03:14 PM
  2. Excel VBA Multiple Automatic Goal Seek Required – Please Assist us
    By champaben in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2014, 04:22 PM
  3. [SOLVED] Automatic Goal Seek
    By Talazem in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-04-2013, 11:28 AM
  4. Faster calculation for multiple automatic goal seek
    By lockd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-26-2013, 09:30 AM
  5. Automatic Goal Seek VBA won't work now
    By Brodie05 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-25-2013, 08:43 PM
  6. GOAL SEEK NOT putting Target value on worksheet
    By gjlindn in forum Excel General
    Replies: 0
    Last Post: 08-04-2011, 03:06 AM
  7. GOAL SEEK NOT putting Target value on worksheet
    By gjlindn in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 08-02-2011, 01:28 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