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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Watch MrExcel Video

Forum statistics

Threads
1,130,051
Messages
5,639,773
Members
417,112
Latest member
PachRedoc

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