home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!DAL.MOBIL.COM!ra_novy
- From: ra_novy@DAL.MOBIL.COM
- Newsgroups: comp.os.os2.apps
- Subject: Excel Macro+Solve Question
- Message-ID: <9208121214.AA17769@mobil.com>
- Date: 12 Aug 92 12:14:23 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Lines: 47
-
- In Excel 3.0, I've been trying to write a macro that will call the Solver
- for each row in a table of data:
-
- | A | B | C
- --------------------------
- 1 | k | x | f(k,x)
- 2 | 3 | 1 | 6
- 3 | 4 | 3 | 7
- 4 | 8 | 5 | 4
- etc.
-
- In Column A is k, a fixed parameter.
- In Column B is x, a variable.
- In Column C is a function of k and x that is to be zeroed by varying x.
-
- So I'd like to have a macro that finds the root of f(k,x) at each value of k.
-
- My problem involves referencing the value of x in the row that is being
- processed. The macro I have is
-
- Record1 (a)
- =RUN('SOLVER Add-in'!Auto_Open)
- =FOR.CELL("TargetCell",,TRUE) [loop through selected cells, i.e. col C]
- =SOLVER.RESET()
- =SOLVER.OK(TargetCell,3,0,!$B$2) [make the target cell zero by varying B2]
- =SOLVER.SOLVE() [execute solver]
- =NEXT() [go to next selected cell]
- =RETURN()
-
- So as it is above, the macro always varies B2 to try to zero each of the values
- in column C. How do I get the solver to vary B3 to zero C3, to vary B4 to zero
- C4, etc?
-
- I've studied the darn manuals most of the afternoon, and I don't see how to
- specify a cell on the ACTIVE sheet RELATIVE to another cell on the same sheet.
-
- If there are several ways to do this, I'd like to be able to use the names of
- the variables in the active sheet when writing the macro. Names would be
- better than row-column references.
-
- Any suggestions would be appreciated. Please e-mail any.
-
- Bob Novy
- ra_novy@dal.mobil.com
- Dallas, TX
-
- Vacuous Justification #1: It's the '90s.
-