简体   繁体   中英

Using solver in Excel VBA on mac

I want to automate a series of solver operations in a VBA macro in Excel 2016 for mac. However, when I run the macro an error keeps popping up. The error I get is "Sub of function not defined". The code I use is the following.

 Sub test_test_test() ' ' test_test_test Macro ' SolverOk SetCell:="$K$3", MaxMinVal:=3, ValueOf:=-20, ByChange:="$K$3", Engine:=1, EngineDesc:="GRG Nonlinear" SolverSolve End Sub 

Thanks a lot! Lennart

You should add solver to references.

To do so, open visual basic editor. There is "Add References ...." button on bottom left of the editor. Click it, check the box for Solver, then click OK. This should work.

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