# Excel Solver!! help

#### eddy23

##### New Member
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.
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-comfficeffice" /><o> </o>
Thank you

### Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
What have you tried? You just need a For Next loop.

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

Can you post your code for solving K14? Are all the other solutions based on the same parameters?

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.

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``````

Replies
0
Views
600
Replies
2
Views
277
Replies
1
Views
622
Replies
4
Views
2K
Replies
8
Views
477

1,196,430
Messages
6,015,222
Members
441,882
Latest member
rcgyuk

### 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.

### Which adblocker are you using?

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

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