Dear All,
The VBA code runs but Solver references doesn't update properly. In Col I Solver only remembers Col Q references plus Range(H92:Q92) doesn't zero out.
<title>Excel Jeanie HTML</title>******>
<!-- ######### Start Created Html Code To Copy ########## -->
RES Var
<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 129px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"></colgroup><tbody>
</tbody>
<tbody>
</tbody>
Excel tables to the web >> Excel Jeanie HTML 4
<!-- ######### End Created Html Code To Copy ########## -->
Your help would be greatly appreciated.
Kind Regards
Biz
The VBA code runs but Solver references doesn't update properly. In Col I Solver only remembers Col Q references plus Range(H92:Q92) doesn't zero out.
<title>Excel Jeanie HTML</title>******>
<!-- ######### Start Created Html Code To Copy ########## -->
RES Var
A | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | |
2 | 2018 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2019 | 2020 | |
3 | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Jan | Feb | Mar | Apr | May | Jun | Jul | |
80 | New $ | 2,010,356 | 2,273,836 | 2,254,752 | 1,978,988 | 1,130 | 2,096,530 | 981,120 | 1,329,598 | 1,676,217 | 940,391 | 1,978,790 | 1,570,310 | 2,717,934 | |
81 | New rate Ent ===> | 0.09167192 | 0.1005 | 0.105621869 | 0.0001 | 0.1362 | 0.0743 | 0.0937 | 0.1183 | 0.0699 | 0.1168 | 0.0869 | 0.1178 | 0.0791 | 0.074989395 |
82 | New rate Movt | 5.6% | 5.9% | -99.9% | 143180.3% | -42.5% | 32.7% | 32.9% | -37.8% | 75.6% | -21.7% | 42.8% | -29.2% | ||
83 | MoM% | 5.1% | -99.9% | 136100.0% | -45.4% | 26.1% | 26.3% | -40.9% | 67.1% | -25.6% | 35.6% | -32.9% | |||
84 | |||||||||||||||
85 | New Rate Cal | 0.1005 | 0.1056 | 0.0001 | 0.1805 | 0.0646 | 0.1007 | 0.1192 | 0.0646 | 0.1276 | 0.0812 | 0.1234 | 0.075 | ||
86 | |||||||||||||||
87 | |||||||||||||||
88 | Total $ | 6,627,187 | 6,503,032 | 5,650,420 | 3,378,568 | 4,547,158 | 3,831,142 | 4,122,848 | 4,120,767 | 3,926,217 | 4,948,151 | 5,250,828 | 6,764,256 | ||
89 | Total Volume | 76,181,424 | 73,492,588 | 64,138,566 | 58,518,891 | 47,041,022 | 48,074,184 | 48,072,808 | 44,301,919 | 49,845,329 | 53,435,936 | 62,985,744 | 73,016,698 | ||
90 | Overall Rate | 86.99 | 88.49 | 88.10 | 57.73 | 96.66 | 79.69 | 85.76 | 93.02 | 78.77 | 92.60 | 83.37 | 92.64 | ||
91 | Required Rate | 86.99 | 88.49 | 86.26 | 85.58 | 85.51 | 86.10 | 86.41 | 86.49 | 86.80 | 86.89 | 87.52 | 88.05 | ||
92 | var | 0.00 | 0.00 | 1.83 | -27.84 | 11.15 | -6.41 | -0.64 | 6.52 | -8.03 | 5.71 | -4.16 | 4.59 |
<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 129px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"><col style="width: 122px;"></colgroup><tbody>
</tbody>
Spreadsheet Formulas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<tbody> </tbody> |
<tbody>
</tbody>
Excel tables to the web >> Excel Jeanie HTML 4
<!-- ######### End Created Html Code To Copy ########## -->
Code:
Sub MultipleSolvers()
Application.ScreenUpdating = False
Dim i As Long, iStart As Long, iEnd As Long
'~~> This prevents an error at blank cells
On Error Resume Next
'SolverAdd(CellRef, Relation, FormulaText)
'
'CellRef Required Variant. A reference to a cell or a range of cells that forms the left side of a constraint.
'Relation Required Integer. The arithmetic relationship between the left and right sides of the constraint.
'If you choose 4, 5 or 6, CellRef must refer to decision variable cells, and FormulaText should not be specified.
'Relation Arithmetic relationship
'1 <=
'2 =
'3 >=
'4 Cells referenced by CellRef must have final values that are integers.
'5 Cells referenced by CellRef must have final values of either 0 (zero) or 1.
'6 Cells referenced by CellRef must have final values that are all different and integers.
iStart = Cells(1, "G").Column
iEnd = Cells(1, "Q").Column
For i = iStart To iEnd
Debug.Print "SetCell: " & Cells(92, i).Address
Debug.Print "ByChange: " & Cells(81, i).Address
Debug.Print "Number" & i
SolverReset
SolverOptions Precision:=0.001
SolverOk SetCell:=Cells(92, i).Address(0, 0), MaxMinVal:=3, ValueOf:=0, ByChange:=Cells(81, i).Address(0, 0), _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd cellRef:=Cells(92, i).Address, relation:=3, formulaText:=0.001
SolverSolve userFinish:=True
Next i
'Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End Sub
Your help would be greatly appreciated.
Kind Regards
Biz