+ Reply to Thread
Results 1 to 2 of 2

Use VBA to automate goal seek (involving a cell in another worksheet)

  1. #1
    Registered User
    Join Date
    08-28-2019
    Location
    Melbourne
    MS-Off Ver
    2016
    Posts
    1

    Post Use VBA to automate goal seek (involving a cell in another worksheet)

    Hello,

    I am very new to VBA and I need some help.

    My situation is that, suppose I am working on sheet2, I have an equation in cell B1 which is dependent on the values in cell A1,A2,A3. I want to solve for the value in cell A3 which will make the equation (B1) become zero. I already found out that I could do it by using goal seek; however, I would also like to have the cell A3 changing automatically, to satisfy the equation, whenever I adjust the values in cell A1 and A2. Moreover, the values in my A1 and A2 have to be input in another worksheet. ie. A1=sheet1!F1 and A2=sheet1!F2.

    I found this code
    Please Login or Register  to view this content.
    Using the code above, when I change the values in cell F1,F2 in sheet1, the value in cell B1 in sheet2 changes but the value in cell A3 sheet2 does not automatically change. I have to double click cell B1 and press Enter for goal seek to work and show the result in cell A3 (and then the value in cell B1 become 0), which is what I need.

    Does anyone know how can I fix the code above so that when I adjust the cells F1 and F2 in sheet1 then cell A3 in sheet2 automatically change and make B1 become 0?
    Unfortunately I cannot use Macros since the model I'm working on will be used in a macro-disabled computer.

    Thank you very much for your help and sorry for my bad English

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

    Re: Use VBA to automate goal seek (involving a cell in another worksheet)

    I am a little confused -- can you, or can you not, use macros? A VBA event procedure is a macro, so you cannot use an event procedure if you cannot use macros.

    If you decide that you can use an event procedure for this, I would probably just change your change event to a calculate event procedure. It seems that the vast majority of event procedure examples are for the change event, but there are several other events that are part of the worksheet object, and the calculate event seems more suitable for the task you want here.

    If you decide that you cannot use an event procedure, I have a tutorial here showing how to build a simple root finding algorithm in the spreadsheet using circular references (so you will need to make sure iteration is enabled on the computer where you will be using this). https://www.excelforum.com/tips-and-...ind-roots.html
    Another example, if it helps: https://www.excelforum.com/excel-for...g-problem.html
    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. Automate Goal Seek Function
    By korny88 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-20-2016, 11:27 AM
  2. Trying to automate "Goal Seek" in a worksheet
    By mjrubin23 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-28-2016, 07:37 PM
  3. Trying to automate Goal Seek Function
    By mjrubin23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2016, 10:13 AM
  4. Automate What IF Analysis (Goal Seek)
    By Savan87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2011, 01:03 PM
  5. Automate Goal Seek in VBA??
    By shaun2985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2009, 09:17 AM
  6. Automate Goal Seek
    By marcghannoum@gm in forum Excel General
    Replies: 6
    Last Post: 01-26-2009, 02:47 PM
  7. Automate Goal Seek?
    By John Richards in forum Excel General
    Replies: 2
    Last Post: 04-23-2005, 10:06 AM

Tags for this Thread

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