+ Reply to Thread
Results 1 to 2 of 2

Looping and Solver

  1. #1
    Registered User
    Join Date
    07-24-2008
    Location
    Tucson
    Posts
    5

    Looping and Solver

    Hello Sir/Madam,

    I am trying to use solver on multiple cells on my spreadsheet within a macro. How can I run solver on each cell separately? I was thinking that I would run solver within a loop and have it loop through each cell running solver on each cell as the target. But, I am having difficulty implementing that.

    Thanks!!

    Regards,

    Januj

  2. #2
    Registered User
    Join Date
    07-24-2008
    Location
    Tucson
    Posts
    5

    Looping and Solver

    Dear Sir/Madam,

    I would like to be more specific about what I was saying, I have the following code

    Sub ObtainFFR()

    Worksheets("Cleaned + Forward Rate 2").Activate


    Do

    SolverReset
    SolverOptions MaxTime:=100, Iterations:=10000, _
    Precision:=0.00000000001, AssumeLinear:=False, _
    StepThru:=False, Estimates:=1, _
    Derivatives:=1, SearchOption:=1, _
    IntTolerance:=0.00000001, Scaling:=False, _
    Convergence:=0.0000001, AssumeNonNeg:=False
    SolverOk SetCell:=Range("U10"), _
    MaxMinVal:=2, ValueOf:="0", _
    ByChange:=Range("Q10:R10")
    SolverSolve UserFinish:=True
    ActiveCell.Offset(1, 0).Range("U10").Select
    ActiveCell.Offset(1, 0).Range("Q10:R10").Select

    Loop Until IsEmpty(ActiveCell.Offset(1, 0))


    End Sub

    This code worked for the cell U10, but I want to run this code for the entire column of U (which has about 3,140 observations) I thought that the ActiveCell.Offset(1,0) command would move me down a row in the active spreadsheet and that the program would terminate when there are no more cells with a formula (Loop Until IsEmpty(ActiveCell.Offset(1, 0)))

    Can you please advise?

    Thanks!!

    Regards,

    Januj

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1