vba 从宏运行 Excel 求解器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15468972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 20:05:25  来源:igfitidea点击:

run Excel Solver from macro

excelvbaexcel-vbasolver

提问by user990330

I want to run Excels Solver from a Macro. I already have all the algorithm parameters manually entered into the Solver window. By just calling

我想从宏运行 Excels Solver。我已经将所有算法参数手动输入到求解器窗口中。只需调用

SolverSolve

I get a compile error.

我收到编译错误。

Any idea how to do this?

知道如何做到这一点吗?

回答by Olle Sj?gren

You must set a reference to the Solver addin in Tools/References:

您必须在 Tools/References 中设置对 Solver 插件的引用:

  1. Select References from the Tools menu in the Excel VBA editor window.
  2. Check the "Solver" checkbox.
  3. Click OK.
  1. 从 Excel VBA 编辑器窗口的工具菜单中选择引用。
  2. 选中“求解器”复选框。
  3. 单击确定。