View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_5_] Dana DeLouis[_5_] is offline
external usenet poster
 
Posts: 77
Default Using Solver within Macro

I may be wrong, but it looks like you have 1 equation with 2 unknowns.
There would be many solutions. For a particular solution, I believe you
need another equation or some type of constraint.
I believe the Solver tool only works with data from a spreadsheet. I don't
believe you can pass it an array of values. One of the first few steps of
Solver is to copy your "changing cells" on a worksheet so that you can later
click to restore the original values. The "Changing Cells" is a Range on
the worksheet.
With two equations in two unknowns, you should be able to Solve for a & b
directly.

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Avner Mediouni" wrote in message
...
Dear Excel Programers,
I would like to know if it is possible to use solver from within a macro,
but not with value kept in cells but with values kept in variables.
for examples, supose I have two variables:
X = 3 and Y = 2. and I want to solve the linear equation:
Y = a*X + b
I would like to pass the function a*X+b-Y to the Solver and solve for a

and
b, without having to write the data to cells in a worksheet and read the
results from this worksheet.

Thanks for the help

Sincerely yours,

Avner Mediouni
R&D Physicist
email: