Use VBA to confirm SOLVER solution dialog

sean.

New Member
Joined
Jul 27, 2011
Messages
3
Thanks in advance for any help,

I'm using Excel 2007 in Windows 7.

I'm trying to automate multiple Solver scenarios. I began by trying to automate just one. I proceeded to record my actions. The result was:
Code:
Sub Macro5()
'
' Macro5 Macro
'


'
    SolverOk SetCell:="$AA$46", MaxMinVal:=1, ValueOf:="0", ByChange:= _
        "$AA$29,$AA$39:$AA$40"
    SolverDelete CellRef:="$Z$29:$Z$40", Relation:=1, FormulaText:="1"
    SolverAdd CellRef:="$AA$29:$AA$40", Relation:=1, FormulaText:="1"
    SolverOk SetCell:="$AA$46", MaxMinVal:=1, ValueOf:="0", ByChange:= _
        "$AA$29,$AA$39:$AA$40"
    SolverDelete CellRef:="$Z$29:$Z$40", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AA$29:$AA$40", Relation:=3, FormulaText:="0"
    SolverOk SetCell:="$AA$46", MaxMinVal:=1, ValueOf:="0", ByChange:= _
        "$AA$29,$AA$39:$AA$40"
    SolverDelete CellRef:="$Z$41", Relation:=2, FormulaText:="1"
    SolverAdd CellRef:="$AA$41", Relation:=2, FormulaText:="1"
    SolverOk SetCell:="$AA$46", MaxMinVal:=1, ValueOf:="0", ByChange:= _
        "$AA$29,$AA$39:$AA$40"
    SolverSolve
End Sub

When I run this macro again, I get a dialog box at the end of it asking me to confirm whether or not to keep the solution.

My question is, can I use VBA to automatically choose the "Keep Solver Solution" radio button (already selected by default) and then click "OK"?

Thanks,
Sean
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You might try recording that from scratch, and start by pressing Reset All. You have a lot of clutter in there.
 
Upvote 0
Unfortunately it does not work for neither 2007 nor 2013 and I still keep clicking "keep results".
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top