Excel Solver!! help

eddy23

New Member
Joined
Jan 31, 2009
Messages
34
I want to run multiple instances of excel solver simultaneously as i am trying to automate some calculations. I was hoping if someone could help me out.:confused:
Basically I have range of cells K14:K27 and M14:M27....each cell i.e. k14 to k27 is the target cell to be used in excel solver. Now I want to run the excel solver only when the adjacent cell in column M contains a value e.g.
run solver operation for K14 when M14 contains a value..run solver for k15 when M15 contains a value so and so forth”.
The vb code/macro needs to lookup the range M14:M27 and then run the solver for cells k14:k27 accordingly
I would greatly appreciate if any1 cud help me out on this mission.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
Thank you
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
What have you tried? You just need a For Next loop.

i created a separate macro for solver operation for each cell in K14:K27, tried running those macros togather.

problem is cells k14:k27 contains values only if there is value in corresponding M14:M27 cell..so the method i applied is certainly not what i want. beacause i want to autmate the it, i was hoping for a vb code that would identify if there are any values in cell M14:M27 and then run solver opearation in the corresponding K14:K27 cells
 
Upvote 0
Can you post your code for solving K14? Are all the other solutions based on the same parameters?

Sub test_solver()
'
' test_solver Macro
'
'
SolverOk SetCell:="$K$14", MaxMinVal:=3, ValueOf:="3.0849", ByChange:="$J$14"
SolverSolve
End Sub


Also is there a chance the parameter "valueOf:=" takes the value from corresponding I14:I27 cells automatically, at the moment im having to manually input this value.
 
Upvote 0
Try:

Code:
Sub Test()
    Dim i As Integer
    For i = 14 To 27
        If IsNumeric(Range("M" & i).Value) Then
            SolverOk SetCell:="$K$" & i, MaxMinVal:=3, ValueOf:=CStr(Range("I" & i).Value), ByChange:="$J$" & i
            SolverSolve UserFinish:=True
        End If
    Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top