SolverGet Function

Description

Returns information about current settings for Solver. The settings are specified in the Solver Parameters and Solver Options dialog boxes.

Before you use this function, you must establish a reference to the Solver add-in. With a Visual Basic module active, click References on the Tools menu, and then select the Solver.xla check box under Available References. If Solver.xla doesn't appear under Available References, click Browse and open Solver.xla in the \Excel\Library\Solver folder.

Syntax

SolverGet(TypeNum, SheetName)

TypeNum Required Integer. A number specifying the type of information you want. The following settings are specified in the Solver Parameters dialog box.

TypeNum

Returns

1

The reference in the Set Target Cell box, or the #N/A error value if Solver hasn't been used on the active sheet.


(continued)

TypeNum

Returns

2

A number corresponding to the Equal To option: 1 represents Max, 2 represents Min, and 3 represents Value Of.

3

The value in the Value Of box.

4

The reference (as a multiple reference, if necessary) in the By Changing Cells box.

5

The number of constraints.

6

An array of the left sides of the constraints, in text form.

7

An array of numbers corresponding to the relationships between the left and right sides of the constraints: 1 represents <=, 2 represents =, 3 represents >=, 4 represents int, and 5 represents bin.

8

An array of the right sides of the constraints, in text form.


The following settings are specified in the Solver Options dialog box.

TypeNum

Returns

9

The maximum calculation time.

10

The maximum number of iterations.

11

The precision.

12

The integer tolerance value.

13

True if the Assume Linear Model check box is selected; False if it's cleared.

14

True if the Show Iteration Results check box is selected; False if it's cleared.

15

True if the Use Automatic Scaling check box is selected; False if it's cleared.

16

A number corresponding to the type of estimates: 1 represents Tangent, and 2 represents Quadratic.

17

A number corresponding to the type of derivatives: 1 represents Forward, and 2 represents Central.

18

A number corresponding to the type of search: 1 represents Quasi-Newton, and 2 represents Conjugate Gradient.

19

The convergence value.

20

True if the Assume Non-Negative check box is selected.


SheetName Optional Variant. The name of the sheet that contains the Solver model for which you want information. If SheetName is omitted, this sheet is assumed to be the active sheet.

See Also

SolverOk function.

Example

This example displays a message if you haven't used Solver on Sheet1.

Worksheets("Sheet1").Activate
state = SolverGet(typeNum:=1)
If IsError(state) Then
    MsgBox "You have not used Solver on the active sheet"
End If