home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / os2 / apps / 5220 next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.8 KB

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