Copy data from solver answer to different cells

dorkas

New Member
Joined
Jun 12, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi Everybody I want help with the vba of the macro below, the idea is to loop through data and then paste the answers to a different part. It is an attempt to optimize fertilizer cost for various gps points as part of a precision Agrculture project , See outlay below:

'
' SOLVER1 Macro
'

'
SolverOk SetCell:="$H$6", MaxMinVal:=2, ValueOf:=0, ByChange:="$H$8:$H$22", _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:="$B$4:$G$4", Relation:=3, FormulaText:="$B$3:$G$3"
SolverOk SetCell:="$H$6", MaxMinVal:=2, ValueOf:=0, ByChange:="$H$8:$H$22", _
Engine:=2, EngineDesc:="Simplex LP"
SolverOk SetCell:="$H$6", MaxMinVal:=2, ValueOf:=0, ByChange:="$H$8:$H$22", _
Engine:=2, EngineDesc:="Simplex LP"
SolverSolve
End Sub

If I run the solver( not cleaned) it returns the answer to H6( the minimized costs), and the amount or optimized fertilizer amounts to (H8:H22), I want to automatically select, the nutrient requirement(C25 : H25) then , run the solver and past the data alternatively to (L7 : Z7) ( OPTIMIZED COSTING) and the amounts of fertilizers to(L8:Z22) with each run...

Thanks for your time

dorkas

currently
Capture.PNG
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,181,322
Messages
5,929,300
Members
436,660
Latest member
Mouseinalabyrinth

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
Top