![]() |
#1
|
|||
|
|||
![]()
I have a simple macro that performs a Solver routine. For one of my variables (cell AF61), I have two constraints:
SolverAdd CellRef:="$AF$61", Relation:=1, FormulaText:="$ak$75" SolverAdd CellRef:="$AF$61", Relation:=3, FormulaText:="$aj$75" So this just ensures that AF61 stays between those two limits. However, I want to specify the value of AF61 right before the solversolve command. I have it in my mind that the "starting value" is important? What I did was just add the following line: AF61 = (AK75 + AJ75)/2 My goal is to make the "starting value" of AF 61 halfway between AK75 and AJ75 (the limits). That line doesn't fail, but I have no idea if it is the right way to specify a cell value in VBA! There are no Dim statements in the solver macro, so I assume the dimensioning has already been taken care of internally. Is there a way to specify the value of cell AF61 in the macro like this? Thanks a lot for any help. |
#2
|
|||
|
|||
![]()
Hello,
I still need to assign a value to a cell within VBA, just before I do the SolverSolve command. I think I should use the .range command? I would like to know if I can use it without a specific worksheet specified? This macro will be used on 30 or 40 sheets of the notebook. I'm thinking of using something like: Worksheets("Sheet1").Range("A5").Value = 50 But I don't want the "sheet1" in there. I want it to work for any sheet, or the active sheet, whatever. Can I make this sort of command work for any sheet? Thanks for any help, Rick |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
izzy786 | Excel | 1 | 09-08-2012 08:04 AM |
Should be a simple macro, need a start | Jamtart | PowerPoint | 7 | 08-13-2012 06:11 AM |
![]() |
Ulodesk | Word VBA | 1 | 06-08-2012 06:24 PM |
Simple VBA macro error | Formulayeti | PowerPoint | 1 | 12-09-2011 10:02 PM |
Simple macro undoable? | garon5 | Outlook | 0 | 04-20-2007 10:27 AM |