Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default solver in macro

Hi Everybody,

I would like to create a macro for using the solver, but i can't. I would
like if the ValueOf could come from a cell, for example the "A1".

That's how it looks now, but I get compile error message:

Sub solver()
'

SolverOk SetCell:="$D$24", MaxMinVal:=3, ValueOf:="600000", ByChange:= _
"$C$8:$C$22"
SolverSolve
End Sub


Thank you in adnvance for your help!
--
sisco98
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default solver in macro

"sisco98" wrote in message
...
I would like to create a macro for using the solver, but i can't. I would
like if the ValueOf could come from a cell, for example the "A1".

That's how it looks now, but I get compile error message:

Sub solver()
'

SolverOk SetCell:="$D$24", MaxMinVal:=3, ValueOf:="600000", ByChange:=
_
"$C$8:$C$22"
SolverSolve
End Sub


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.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default solver in macro

Thank you very much for your quick help, but unfortunatelly, I still can't
use it. Maybe i am too unclever.

Thanks anyway,

my regards

--
sisco98


"Rob Bovey" wrote:

"sisco98" wrote in message
...
I would like to create a macro for using the solver, but i can't. I would
like if the ValueOf could come from a cell, for example the "A1".

That's how it looks now, but I get compile error message:

Sub solver()
'

SolverOk SetCell:="$D$24", MaxMinVal:=3, ValueOf:="600000", ByChange:=
_
"$C$8:$C$22"
SolverSolve
End Sub


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.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default solver in macro

Hi. Make sure Solver is loaded as an Add-Inn from the worksheet menu, then
in the vba window...

XL2000: Compile Error Occurs Running a Recorded Macro That Uses the Solver
Add-in
http://support.microsoft.com/default...b;en-us;213689

As a side note, if your changing cells are small in value (I'm looking at
target of 600,000), and you are having a problem with a solution, you may
want to try the following option:
SolverOptions Scaling:=True

HTH
--
Dana DeLouis
Win XP & Office 2003


"sisco98" wrote in message
...
Hi Everybody,

I would like to create a macro for using the solver, but i can't. I would
like if the ValueOf could come from a cell, for example the "A1".

That's how it looks now, but I get compile error message:

Sub solver()
'

SolverOk SetCell:="$D$24", MaxMinVal:=3, ValueOf:="600000", ByChange:=
_
"$C$8:$C$22"
SolverSolve
End Sub


Thank you in adnvance for your help!
--
sisco98



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default solver in macro

Hello, thank you for your help, but i still can't use it:-( Probably I do
something wrong.

thanks and bye

--
sisco98


"Dana DeLouis" wrote:

Hi. Make sure Solver is loaded as an Add-Inn from the worksheet menu, then
in the vba window...

XL2000: Compile Error Occurs Running a Recorded Macro That Uses the Solver
Add-in
http://support.microsoft.com/default...b;en-us;213689

As a side note, if your changing cells are small in value (I'm looking at
target of 600,000), and you are having a problem with a solution, you may
want to try the following option:
SolverOptions Scaling:=True

HTH
--
Dana DeLouis
Win XP & Office 2003


"sisco98" wrote in message
...
Hi Everybody,

I would like to create a macro for using the solver, but i can't. I would
like if the ValueOf could come from a cell, for example the "A1".

That's how it looks now, but I get compile error message:

Sub solver()
'

SolverOk SetCell:="$D$24", MaxMinVal:=3, ValueOf:="600000", ByChange:=
_
"$C$8:$C$22"
SolverSolve
End Sub


Thank you in adnvance for your help!
--
sisco98






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default solver in macro

I'm assuming you solved your initial compile error. What problem do
you have now?

Also, to use a cell value in place of the 600000 use the code below.
Together with setting a reference to the Solver add-in, it works just
fine.

SolverOk SetCell:="$D$24", MaxMinVal:=3, _
ValueOf:=Range("a1").Value, _
ByChange:="$C$8:$C$22"
SolverSolve

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hello, thank you for your help, but i still can't use it:-( Probably I do
something wrong.

thanks and bye


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
How can I run solver add-in in a macro? Solver Question Excel Programming 1 May 24th 05 11:22 AM
SOLVER macro emilija Excel Programming 1 April 22nd 05 02:29 PM
solver macro Andres[_2_] Excel Programming 0 June 8th 04 09:36 PM
Macro for Solver Velero Excel Programming 2 February 19th 04 01:39 PM


All times are GMT +1. The time now is 07:08 AM.

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"