Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Setting a Solver constraint using vba?

[This followup was posted to microsoft.public.excel.programming with an
email copy to Tony Scullion.
Please use the newsgroup for further discussion.]

To get the code to add a Solver constraint, turn on the macro recorder
(Tools | Macro Record new macro...), and add the constraint through
the GUI.

Then, add a loop and an IF statement along the lines of the untested:

Dim i as Long
....
for i=11 to 15
IF isempty(range("U" & i)) then
else
{add constraint here, adjusting the generated code to apply to
Range("U" & i)}
end if
next i

--
Trouble finding replies to your posts? Use a newsreader. See the
tutorial 'Outlook Express and Newsgroups' on my web site

Regards,

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


In article ,
says...
Hi Group,

How do I add constraints in Solver whereby it checks cells
U11:U15 for data and, if data exists, then make it match
the constraints that I'm trying to apply. If no data
exist then ignore the constraints altogether.

Currently, I have Solver set-up to check if an entry
exists using <=. This works fine if data exists but if
there is no data it tries to match a blank entry.

I think this needs to be done using vba - does someone
know how to help me.

Thanks

Tony


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
What is the size constraint of the Excel 2007 solver? aelshahat Excel Discussion (Misc queries) 0 February 6th 08 05:40 PM
solver result and constraint CHART rml Charts and Charting in Excel 0 November 10th 06 09:13 PM
Add Constraint - "Solver: tikchye_oldLearner57 Excel Discussion (Misc queries) 2 August 14th 06 06:37 AM
Solver parameter constraint question Morrigan Excel Discussion (Misc queries) 7 June 7th 05 10:01 PM
solver constraint jojo Excel Worksheet Functions 0 February 17th 05 11:11 PM


All times are GMT +1. The time now is 11:14 AM.

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"