Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2013, 04:28 PM
ue418 ue418 is offline Simple Macro help for Excel Solver Windows 7 32bit Simple Macro help for Excel Solver Office 2000
Novice
Simple Macro help for Excel Solver
 
Join Date: May 2012
Posts: 17
ue418 is on a distinguished road
Default Simple Macro help for Excel Solver

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.
Reply With Quote
  #2  
Old 06-23-2013, 12:34 PM
ue418 ue418 is offline Simple Macro help for Excel Solver Windows 7 32bit Simple Macro help for Excel Solver Office 2000
Novice
Simple Macro help for Excel Solver
 
Join Date: May 2012
Posts: 17
ue418 is on a distinguished road
Default Update on assigning cell value in VBA

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Macro help for Excel Solver Simple graph in excel 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
Simple Macro help for Excel Solver Another simple macro problem 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft