novice_2010
Board Regular
- Joined
- Mar 18, 2010
- Messages
- 105
Hello, All,
My first macro is:
My second macro is:
I thought the Solver result would be the same. However, they are not.
What mistakes did i make?
My first macro is:
And the result is:Sub Worked_Solver_Macro()
Range("A5").FormulaR1C1 = "5"
Range("A6").FormulaR1C1 = "1"
Range("A7").FormulaR1C1 = "=(R[-2]C-R[-1]C)^2"
SolverOk SetCell:="$A$7", MaxMinVal:=2, ValueOf:="0", ByChange:="$A$5"
SolverSolve
End Sub
My second macro is:
And the result is:Sub Not_Worked_Solver_Macro()
Dim Variable_X as Long
Range("A1").FormulaR1C1 = "5"
Variable_X=Range("A1").value
Range("A5") = Variable_X
Range("A6").FormulaR1C1 = "1"
Range("A7").FormulaR1C1 = "=(R[-2]C-R[-1]C)^2"
SolverOk SetCell:="$A$7", MaxMinVal:=2, ValueOf:="0", ByChange:="$A$1"
SolverSolve
End Sub
I thought the Solver result would be the same. However, they are not.
What mistakes did i make?