Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tdogg241
 
Posts: n/a
Default Writing a macro that updates solver solutions?

I want to write a macro that will update several cells that are calculated
using the solver function. So far, the only way I've found to do this is to
update them one-by-one which is very tedious. So I'm trying to write a macro
that will do this easily. I tried recording the macro and doing it manually,
which gave me the following code:

SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:="100", ByChange:="$A$32"
SolverSolve

Unfortunately, when I try to run the macro, it says that the SolverOk
function is not a valid function. So I'm not sure what I can do to fix this.
Any help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default Writing a macro that updates solver solutions?

First make sure that Solver is open. This may require selecting Solver
from the Excel menu and then dismissing the dialog. You'll know Solver is
open when you can see the entry SOLVER (SOLVER.XLA) in the Visual Basic
Editor Project window.

Next, select your workbook's project in the Visual Basic Editor Project
window and choose Tools/References from the menu. Put a check mark beside
the SOLVER reference and click OK. Save your workbook. Your code should work
now.


--
Gary''s Student


"tdogg241" wrote:

I want to write a macro that will update several cells that are calculated
using the solver function. So far, the only way I've found to do this is to
update them one-by-one which is very tedious. So I'm trying to write a macro
that will do this easily. I tried recording the macro and doing it manually,
which gave me the following code:

SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:="100", ByChange:="$A$32"
SolverSolve

Unfortunately, when I try to run the macro, it says that the SolverOk
function is not a valid function. So I'm not sure what I can do to fix this.
Any help is greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tdogg241
 
Posts: n/a
Default Writing a macro that updates solver solutions?

Well, I did some looking around and found out about having Solver open, so I
took care of that. And I also saw the SolverSolve and SolverFinish functions
and added those in an attempt to get it to work properly. So now my code
looks like this:

SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:=100, ByChange:="$A$32"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=True

It seems to run all the way through to the end, but it doesn't save the
calculations. Also, I don't know whether it matters, but I have 4 statements
like the one above performing SolverOk for different parts of my sheet. I
have also tried inserting a SolverReset line at the beginning, so I have no
idea why it's not working.

"Gary''s Student" wrote:

First make sure that Solver is open. This may require selecting Solver
from the Excel menu and then dismissing the dialog. You'll know Solver is
open when you can see the entry SOLVER (SOLVER.XLA) in the Visual Basic
Editor Project window.

Next, select your workbook's project in the Visual Basic Editor Project
window and choose Tools/References from the menu. Put a check mark beside
the SOLVER reference and click OK. Save your workbook. Your code should work
now.


--
Gary''s Student


"tdogg241" wrote:

I want to write a macro that will update several cells that are calculated
using the solver function. So far, the only way I've found to do this is to
update them one-by-one which is very tedious. So I'm trying to write a macro
that will do this easily. I tried recording the macro and doing it manually,
which gave me the following code:

SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:="100", ByChange:="$A$32"
SolverSolve

Unfortunately, when I try to run the macro, it says that the SolverOk
function is not a valid function. So I'm not sure what I can do to fix this.
Any help is greatly appreciated.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to run Solver using a macro? EA405 Excel Worksheet Functions 1 May 2nd 06 08:05 PM
Macros involving SOLVER... function Pixies Excel Discussion (Misc queries) 5 April 20th 06 05:07 PM
webquery and solver macros icestationzbra Excel Discussion (Misc queries) 2 February 23rd 06 06:47 PM
Macro writing a Macro John Vickers Excel Discussion (Misc queries) 3 February 16th 06 07:25 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM


All times are GMT +1. The time now is 04:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"