close

Currently I have a simple solver VBA script in my excel workbook. The
script sets the value of cell quot;I1quot; to 1 by changing cell quot;H1quot;, as shown
below:

Sub repeatsolve()
'
SolverOk SetCell:=quot;$I$1quot;, MaxMinVal:=3, ValueOf:=quot;1quot;,
ByChange:=quot;$H$1quot;
SolverSolve
End Sub

What I would like to do is set the value of all cells in the quot;Iquot;
column, of a specific range, to 1 by changing its respective cell in
column quot;Hquot;. Does anyone have any suggestions? Thank in advance.--
kwrohde
------------------------------------------------------------------------
kwrohde's Profile: www.excelforum.com/member.php...foamp;userid=5721
View this thread: www.excelforum.com/showthread...hreadid=501834Try the untested

Sub repeatSolver()
Dim aRng As Range, aCell As Range
With ActiveSheet
For Each aCell In .Range(.Range(quot;I1quot;), .Range(quot;I1quot;).End(xlDown))
solverreset
SolverOk SetCell:=aCell.Address, MaxMinVal:=3, ValueOf:=quot;1quot;, _
ByChange:=aCell.Offset(0, -1).Address
SolverSolve
Next aCell
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article gt;,says...
gt;
gt; Currently I have a simple solver VBA script in my excel workbook. The
gt; script sets the value of cell quot;I1quot; to 1 by changing cell quot;H1quot;, as shown
gt; below:
gt;
gt; Sub repeatsolve()
gt; '
gt; SolverOk SetCell:=quot;$I$1quot;, MaxMinVal:=3, ValueOf:=quot;1quot;,
gt; ByChange:=quot;$H$1quot;
gt; SolverSolve
gt; End Sub
gt;
gt; What I would like to do is set the value of all cells in the quot;Iquot;
gt; column, of a specific range, to 1 by changing its respective cell in
gt; column quot;Hquot;. Does anyone have any suggestions? Thank in advance.
gt;
gt;
gt; --
gt; kwrohde
gt; ------------------------------------------------------------------------
gt; kwrohde's Profile: www.excelforum.com/member.php...foamp;userid=5721
gt; View this thread: www.excelforum.com/showthread...hreadid=501834
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()