+ Reply to Thread
Results 1 to 2 of 2

vba goal seek 2

  1. #1
    Registered User
    Join Date
    05-04-2005
    Posts
    13

    vba goal seek 2

    Hi, my intent is to perform goal seek for each row (twice) from row 19 to 27 as follow. Somehow the goal seek below row 19 cannot be "activated" unless the value in the "most upper right cell", in this case Range("BA19") is targeted. I don't quite see the logic. I was thinking about using "for each ... in ..." but didn't know how to set the group as rows?

    Method 1:
    For i = 19 To 27
    Cells(i, "AE").GoalSeek Goal:=Cells(i, "AD"), ChangingCell:=Cells(i, "AF")
    Cells(i, "AZ").GoalSeek Goal:=Cells(i, "O"), ChangingCell:=Cells(i, "BA")
    Next i

    Method 1: If row 19 is targeted, then goal seek from 19 to 27 will be activated. However, if row below 19 is targeted, no goal seek because the count has to start from row 19?


    Method 2:
    Range("AE19").GoalSeek Goal:=Range("AD19"), ChangingCell:=Range("AF19")
    .......
    Range("AE27").GoalSeek Goal:=Range("AD27"), ChangingCell:=Range("AF27")

    Range("AZ19").GoalSeek Goal:=Range("O19"), ChangingCell:=Range("BA19")
    ......
    Range("AZ27").GoalSeek Goal:=Range("O27"), ChangingCell:=Range("BA27")

    Method 2: Goal seek only activates for "AF", no goal seek for "BA" because row 19 through 27 has already been passed once on worksheet_calculate()? I guess it's a looping problem.

    Thanks for your input.

  2. #2
    Registered User
    Join Date
    05-04-2005
    Posts
    13
    Please ignore the post. The following seems to work fine, didn't know why it wasn't working yesterday. I might have missed a couple of inputs within the row or the goal seek just wasn't converging. Thanks all!

    Method 1:
    For i = 19 To 27
    Cells(i, "AE").GoalSeek Goal:=Cells(i, "AD"), ChangingCell:=Cells(i, "AF")
    Cells(i, "AZ").GoalSeek Goal:=Cells(i, "O"), ChangingCell:=Cells(i, "BA")
    Next i

+ 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