[Excel Solver issue] There is a different when run the macro whit or whitout a button

Copper Contributor

I  Add a sub and run it in Vbe or View->Macros->Run

 

 

 

 

 

Sub test1()
    SolverReset
    SolverAdd CellRef:="$a$1", Relation:=1, FormulaText:="1"
End Sub

 

 

 

 

 

 

The result is what i need

dxq92_0-1655052728499.png

 

But when i add a button to run the macro,There is nothing .

dxq92_1-1655052780465.png

 

after that i modify 1 to 0.99 and run it again.

 

 

 

 

 

Sub test1()
    SolverReset
    SolverAdd CellRef:="$a$1", Relation:=1, FormulaText:="0.9999"
End Sub

 

 

 

 

 

dxq92_2-1655052899239.png

 

1 Reply