+ Reply to Thread
Results 1 to 2 of 2

Goal Seek loop - VBA

  1. #1
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Goal Seek loop - VBA

    Morning all,

    I'm trying to Goal seek a % dependent upon a copy and past of other cells...

    that's probably not going to make sense so please see attached.

    I have created a macro to copy and paste the values, however once they are copy and pasted I then need to run goal seek so that cell B8=B12 and then copy paste etc etc...

    Is there a continuous loop I can run that copy pastes then runs goal seek until B8=B12??

    Many thanks in advance.Test1.xlsm

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,528

    Re: Goal Seek loop - VBA

    I get a "file format not recognized" error trying to open your sample file.

    I would expect at the heart of such a loop would be a statement calling the goalseek method of the range object: http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

    Sometimes, especially if B8 and B12 can change, I prefer to add a helper cell to this kind of model =B8-B12. Then, when I call GoalSeek, I can have the goal be 0 by changing the input variable. This will save needing to figure out "what is the 'goal' value for this loop" step in running the loop.

    Sometimes, I think the easiest way to get a starting point for code like this is to record a macro while I perform one iteration of the loop manually. Then I can modify that code and put it in the desired loop.
    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. Help! Macro for a Goal Seek Loop
    By 18757173 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2012, 11:26 PM
  2. Replies: 3
    Last Post: 07-27-2012, 01:44 PM
  3. Goal Seek Formula But Not Using Goal Seek
    By cady923 in forum Excel General
    Replies: 1
    Last Post: 08-05-2011, 03:53 PM
  4. Goal Seek VBA FOR/LOOP
    By BFlick11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2010, 02:50 PM
  5. Goal Seek in a loop
    By Brother in forum Excel General
    Replies: 2
    Last Post: 07-22-2005, 12:05 PM

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