Calling Excel Solver VBA from another worksheet
Question
After creating a new workbook, I am trying to solve a newly created worksheet of this workbook in VBA. Despite of activating the new worksheet, Solver attempts to solve the worksheet, where the macro lies.
Any suggestions, on how to make sure Solver solves the right worksheet?
I use this code to activate the worksheet.
ws.Activate
And this is an example, how I reference the cells in the parametrization of Solver.
SolverOk SetCell:=Range("$E$" & i)
Solution
I just had to reopen the workbook.
Workbooks.Open "foo.xls"
wb.Activate
ws.Activate
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow