Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Using Solver with Named Ranges

I wrote the following code to quickly obtain optimum values using Solver.
The code is below.

Sub quikSolv(rngSolver_Target As Range, rngSolver_Output As Range,
iMaxMinVal As Integer)
' This macro uses SOLVER to set the traget cell to zero by changing the
output cell

SolverReset
SolverOk SetCell:=rngSolver_Target.Address, MaxMinVal:=iMaxMinVal,
ValueOf:="0", _
ByChange:=rngSolver_Output.Address
SolverAdd CellRef:=rngSolver_Output.Address, Relation:=3, FormulaText:="0"
SolverSolve True

End Sub

To make my code and spreadsheets easier to read, I am using six named ranges
in other routines, and I am sending them to the above macro. However, even
though I am using the Range.Address property to assign the Solver parameters,
Solver keeps changing the address to the string of the named range. Then, it
fails to optimize, saying "Set Target Cell contents must be a formula."

Is there any way around this?

Thanks,
Pflugs
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
solver ranges blenno Excel Programming 2 February 19th 07 03:57 PM
union of named ranges based only on the names of those ranges sloth Excel Programming 3 October 2nd 06 03:18 AM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM


All times are GMT +1. The time now is 06:47 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"