Solver - placed in another sheet

ShvDK

Board Regular
Joined
Sep 5, 2003
Messages
92
Hi Xl'ers!
I have a workbook with 2 sheets named "Frontpage" and "Data".

In the sheet "Frontpage" I have a button that runs a macro with a solver where all the inputs are placed in the sheet "Data" (The sheet data is hided for the user). I have named all the inputs in the namebox.

My problem is that I can only run the macro from the sheet "Data" and not from "Frontpage". Of course I can just unhide and select the sheet "Data" when the macro performs, and then return to "Frontpage", but is there any other solution???

Kind regards;

ShvDk

The macro is:

Sheets("Data").Visible=True
Sheets("Data").Select
Range("BV81").Select

Range("str1_cellref1").Value = 0
SolverReset
SolverAdd CellRef:="str1_cellref1", Relation:=3, FormulaText:="str1_cons1"
SolverOk SetCell:="str1_setcell1", MaxMinVal:=3, ValueOf:="0", ByChange:="str1_cellref1"
SolverSolve Userfinish:=True
SolverFinish Keepfinal:=1

Sheets("Data").Visible=False
Sheets("Frontpage").Select
Range("B33").Select
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,073
Messages
5,857,197
Members
431,862
Latest member
wiz of az

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
Top