problem with Solver

tweety

New Member
Joined
Dec 28, 2003
Messages
23
Hi,

Since VBA doesn't know what SolverReset is - so I tried to tell it by clicking Tools, References and choosing Solver in the list but I can't find it from the list. I am using office XP2000, is there any alternative name for Solver?

And I also tried to add a line of code without setting a reference but it still doesn't work.

Sub Eff0()
'to return an efficient portfolio for given target return
SolverReset = Application.Run "Solver.xla!SolverReset"

Call SolverAdd(Range("portret1"), 2, Range("target1"))
Call SolverOk(Range("portsd1"), 2, 0, Range("change1"))
Call SolverSolve(True)
SolverFinish
End Sub

Could you tell me what mistake I made?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,

First of all, there's no need to create a new topic, you can just reply to your original post. This keeps the board tidier and prevents duplicate answers. Thanks :)


Anyway, in order to do anything with Solver you need to ensure that the Solver addin is loaded. If you click Tools, Addins is the Solver Addin checkbox ticked? If not, it should be.
 
Upvote 0
Sorry i just thought people will think i am trying to reply not ask a question any way i will stick to the sam topic if i have a same question

I check to see is my solver add in and it turn out that it has. i follow your instruction and change my code from this:

SolverReset
Call SolverAdd(Range("portret1"), 2, Range("target1"))
Call SolverOk(Range("portsd1"), 2, 0, Range("change1"))
Call SolverSolve(True)
SolverFinish
End Sub


to

Sub Eff0()
'to return an efficient portfolio for given target return
SolverReset = Application.SolverReset


Call Application.SolverAdd(Range("portret1"), 2, Range("target1"))
Call Application.SolverOk(Range("portsd1"), 2, 0, Range("change1"))
Call Application.SolverSolve(True)
Application.SolverFinish
End Sub

however it give me an error message saying object doesn't support this prroperty and method.

by the way do anyone know a good books or webssite that explain the error message someone on this borad suggest i go to VBA help but i find the explaining is very complicated for a seld - learner


Cheers
christy
 
Upvote 0
Hi,

Try this:-

Code:
Sub Eff0()
'to return an efficient portfolio for given target return
SolverReset

SolverAdd Range("portret1"), 2, Range("target1")
SolverOk Range("portsd1"), 2, 0, Range("change1")
SolverSolve True
SolverFinish True
End Sub

In order for this to work you must have selected Tools, References and ticked the SOLVER box.
 
Upvote 0
thanks for your quick reply

however i go to Tools, References i see many function that i can tick but i can find a Solver box that i tick on is solver box avaiable for office 2000
 
Upvote 0
In the References dialog box, click the Browse... button and find the Solver.xla file. By default it would be in the \ Office \ Library \ Solver folder.

tweety said:
thanks for your quick reply

however i go to Tools, References i see many function that i can tick but i can find a Solver box that i tick on is solver box avaiable for office 2000
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,688
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top