LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problems with solver and vba

Dear all,
i'm trying to create a Visual Basic Macro that uses Excel
Solver.
I simply put on cell A1 a numeric value (example 3) and
on cell B1 the formula =A1*A1
Then in VBA i write the following:

-----------------------------------------------------
Sub Find_Square_Root()

' Set up the parameters for the model.
' Set the target cell A2 to a Value of 50 by changing
cell A1.
SolverOK SetCell:=Range("A2"), MaxMinVal:=3,
ValueOf:=50, _
ByChange:=Range("A1")

' Solve the model but do not display the Solver
Results dialog box.
SolverSolve UserFinish:=True

' Finish and keep the final results.
SolverFinish KeepFinal:=1

End Sub
----------------------------------------------------------

Unfortunately by executing the macro from EXCEL nothing
happens. It seems that SOLVER is not able to load the
variables.
I can solve the problem by making a pre-run of SOLVER
from EXCEL setting the target cells and the cells to be
modified by hand.
Once that this pre-run is done I can load the macro that
works perfectly.

Is there any way to avoid initialising SOLVER from EXCEL
by hand and let it work from the macro?

thanks
Marco



 
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
Solver problems in 2007 - linked pictures Duke Carey Excel Discussion (Misc queries) 0 December 13th 07 07:00 PM
Solver problems Mike Excel Worksheet Functions 0 May 15th 06 02:42 PM
Solver Problems Walker Excel Worksheet Functions 2 May 2nd 05 07:33 PM
More Solver Problems Frederick Waithe Excel Programming 2 June 28th 04 02:00 PM


All times are GMT +1. The time now is 12:05 PM.

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

About Us

"It's about Microsoft Excel"