Solver can only be run on the active sheet so you could make your function to a macro that sets sheet1 as the active sheet and the run solver. Alternative loop through Sheet1 and Sheet2
This macro will run solver on Sheet1 and Sheet2. It also assumes that the setting of target cell, cell to change and target value are the same on both sheets. Calling the solver engine it is sufficient to just name the engine i.e. Engine:=1 instead of Engine:=1, EngineDesc:=GRG Nonlinear. Excel is rather fuzzy when building macros. Adding the line "SolverReset" stops buildup of constraint when running solver in a loop. In this case really not needed.
Alf
Bookmarks