ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel 2007: Creating a macro that will run Solver. (https://www.excelbanter.com/excel-discussion-misc-queries/449942-excel-2007-creating-macro-will-run-solver.html)

[email protected]

Excel 2007: Creating a macro that will run Solver.
 
Hello,

I've set up a Solver in an excel sheet, and I'm trying to create a macro that will initiate the Solver when the user clicks a textbox in the Excel sheet.

I recorded the macro, and it runs splendidly on Excel 2010. However, when I try to run it on Excel 2007, I receive the error message: "Solver: An unexpected internal error occurred, or available memory was exhausted."

I'm new to using VB, but I've checked the references and SOLVER is already checked. The Solver also works when I run it manually outside of the macro.

After reading online, I figured out how to unlock the SOLVER (SOLVER.XLAM) code, to try to make modificatinos, but I'm unclear as to what to do next.

My current macro code is as follows:

--------------------------------------------

Sub RunCalc()

' RunCalc Macro
'

'
Sheets("Set-up (DO NOT ALTER)").Select
Range("G13:G17").Select
SolverOk MaxMinVal:=1, ValueOf:="0", ByChange:="$G$13:$G$17"
SolverSolve
Sheets("Kcentra Calculator").Select
End Sub

-----------------------------------------------

Anyhow know how to fix this? I'd truly appreciate the assistance!


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com