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 in the Available References box. If Solver.xla doesn't appear in the Available References box, click Browse, click Solver in the \Excel\Library\Solver folder, and then click OK.

Syntax

SolverGet(typeNum, sheetName)

typeNum

Required. 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.

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 >=, and 4 represents int.

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.


sheetName

Optional. The name of a sheet that contains the scenario 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 have not 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