#1   Report Post  
Posted to microsoft.public.excel.misc
kwrohde
 
Posts: n/a
Default Solver VBA


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

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

What I would like to do is set the value of all cells in the "I"
column, of a specific range, to 1 by changing its respective cell in
column "H". Does anyone have any suggestions? Thank in advance.


--
kwrohde
------------------------------------------------------------------------
kwrohde's Profile: http://www.excelforum.com/member.php...fo&userid=5721
View this thread: http://www.excelforum.com/showthread...hreadid=501834

  #2   Report Post  
Posted to microsoft.public.excel.misc
Tushar Mehta
 
Posts: n/a
Default Solver VBA

Try the untested

Sub repeatSolver()
Dim aRng As Range, aCell As Range
With ActiveSheet
For Each aCell In .Range(.Range("I1"), .Range("I1").End(xlDown))
solverreset
SolverOk SetCell:=aCell.Address, MaxMinVal:=3, ValueOf:="1", _
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 ,
says...

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

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

What I would like to do is set the value of all cells in the "I"
column, of a specific range, to 1 by changing its respective cell in
column "H". Does anyone have any suggestions? Thank in advance.


--
kwrohde
------------------------------------------------------------------------
kwrohde's Profile:
http://www.excelforum.com/member.php...fo&userid=5721
View this thread: http://www.excelforum.com/showthread...hreadid=501834


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solver does not work from Macros mjd918 Setting up and Configuration of Excel 1 January 6th 06 04:15 PM
Interesting Solver problem (Solver encounters an error) MrShorty Excel Discussion (Misc queries) 3 December 22nd 05 10:52 PM
Excel Solver Issue nakedbamboo Excel Discussion (Misc queries) 5 November 14th 05 01:26 AM
Trouble with Solver Wanderingspirit99 Excel Discussion (Misc queries) 0 September 12th 05 03:50 PM
Using Solver with VBA EggShell Excel Discussion (Misc queries) 2 August 22nd 05 07:06 AM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"