Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Solver Record Macro Function

All:

I am at a loss on how to use Solver in VBA. I have recorded a macro
based on my Solver requirements. Once I attempt to run this recorded
code, it does nothing.

I have spent hours trying to ensure my references were correct and
that the syntax is correct.

Can someone assist me either via this board or off line.

Running Solver manually works perfectly; however, when I attempt to
automate this it does nothing. There are no error messages and the
target cell never changes. It is as if it is not running at all.

I am assuming there are no issues with the spreadsheet, since Solver
seems to work just fine when initiated manually.

Here is the code:
Sub Macro10()
Dim ShtOb As Object

Worksheets("Pressure Analysis").Activate
Set ShtOb = Worksheets("Pressure Analysis")
SolverReset
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=1,
FormulaText:=4215
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=3,
FormulaText:=250
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverSolve UserFinish:=True
End Sub

Any suggestions would be greatly appreciated.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Solver Record Macro Function

Just guessing here. Would this apply?

XL2000: The Solver Add-in May Not Work When You Start Solver by Using a
Macro

http://support.microsoft.com/default...30&Product=xlw

(I notice you have two SolverOk statements??)

Technique only would be to reverse these two statements. (Less chance for
typo errors)

Set ShtOb = Worksheets("Pressure Analysis")
ShtOb.Activate


HTH
Dana DeLouis


"Floyd Bates" wrote in message
...
All:

I am at a loss on how to use Solver in VBA. I have recorded a macro
based on my Solver requirements. Once I attempt to run this recorded
code, it does nothing.

I have spent hours trying to ensure my references were correct and
that the syntax is correct.

Can someone assist me either via this board or off line.

Running Solver manually works perfectly; however, when I attempt to
automate this it does nothing. There are no error messages and the
target cell never changes. It is as if it is not running at all.

I am assuming there are no issues with the spreadsheet, since Solver
seems to work just fine when initiated manually.

Here is the code:
Sub Macro10()
Dim ShtOb As Object

Worksheets("Pressure Analysis").Activate
Set ShtOb = Worksheets("Pressure Analysis")
SolverReset
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=1,
FormulaText:=4215
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=3,
FormulaText:=250
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverSolve UserFinish:=True
End Sub

Any suggestions would be greatly appreciated.

Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Solver Record Macro Function

i have the same problem. did you find a solution and if so, can you tell us?
thank
toby

"Dana DeLouis" wrote:

Just guessing here. Would this apply?

XL2000: The Solver Add-in May Not Work When You Start Solver by Using a
Macro

http://support.microsoft.com/default...30&Product=xlw

(I notice you have two SolverOk statements??)

Technique only would be to reverse these two statements. (Less chance for
typo errors)

Set ShtOb = Worksheets("Pressure Analysis")
ShtOb.Activate


HTH
Dana DeLouis


"Floyd Bates" wrote in message
...
All:

I am at a loss on how to use Solver in VBA. I have recorded a macro
based on my Solver requirements. Once I attempt to run this recorded
code, it does nothing.

I have spent hours trying to ensure my references were correct and
that the syntax is correct.

Can someone assist me either via this board or off line.

Running Solver manually works perfectly; however, when I attempt to
automate this it does nothing. There are no error messages and the
target cell never changes. It is as if it is not running at all.

I am assuming there are no issues with the spreadsheet, since Solver
seems to work just fine when initiated manually.

Here is the code:
Sub Macro10()
Dim ShtOb As Object

Worksheets("Pressure Analysis").Activate
Set ShtOb = Worksheets("Pressure Analysis")
SolverReset
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=1,
FormulaText:=4215
SolverAdd CellRef:=ShtOb.Cells(64, 15), Relation:=3,
FormulaText:=250
SolverOk SetCell:=ShtOb.Cells(54, 15), MaxMinVal:=3,
ValueOf:=4215, ByChange:=ShtOb.Cells(64, 15)
SolverSolve UserFinish:=True
End Sub

Any suggestions would be greatly appreciated.

Thanks in advance.




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
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
What does it mean to record the macro Liz Excel Discussion (Misc queries) 6 March 15th 07 07:35 PM
How to record the EXCEL Solver Parameters Dialog Box? pierre Excel Discussion (Misc queries) 1 March 10th 06 11:52 AM
need a function (not macro with ontime) to record a snapshot of a changing cell Shannon Excel Programming 3 February 2nd 04 06:26 PM
Calling up the Solver function in a VBA macro Ken Wright Excel Programming 3 January 28th 04 04:21 PM


All times are GMT +1. The time now is 07:51 PM.

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"