views:

429

answers:

1

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)
+1  A: 

I just had to reopen the workbook.

Workbooks.Open "foo.xls"
wb.Activate
ws.Activate
Roman Glass