vba goal seek 2

C

csw78

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.
 
C

csw78

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top