简体   繁体   中英

How to write a goal seek function in python?

How to write the following code in python?

Private Sub Worksheet_Calculate()
   Range("C5").GoalSeek goal:=Range("F5"), changingcell:=Range("B5")
End Sub

In this code, C5 is the cell that goal seek is solving for (where it places the result). F5 is the cell where the goal value resides, and B5 is the cell that goal seek will change to get C5 = F5

Here is the goal seek function working in Python, as same as in Excel. Please see the script "ExampleScript.py" to see how it works. The link: https://github.com/DrTol/GoalSeek_Python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM