Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Compile issue using Solver

Sub Macro2()
'
' Macro2 Macro
'

'
    Range("G5").Select
    SolverOk SetCell:="$G$5", MaxMinVal:=2, ValueOf:=0, ByChange:="$G$4", Engine:=1 _
        , EngineDesc:="GRG Nonlinear"
    SolverOk SetCell:="$G$5", MaxMinVal:=2, ValueOf:=0, ByChange:="$G$4", Engine:=1 _
        , EngineDesc:="GRG Nonlinear"
    SolverSolve
End Sub

I got a message box:

"Compile error: Sub or function not defined"

I guess the message refers to function or sub SolverOk.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Anyone can help me. Thanks in advance

>Solution :

You need to create a reference to the Solver object, via the VBA menu Tools > References.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading