Nested Do While Loops...PROBLEM HELP

Skiera2

New Member
Joined
Mar 24, 2011
Messages
7
I wrote this code, but can't figure out how to get the data to compute all 15,360 iterations based on 10 variables (in blue boxes):
<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:EnableOpenTypeKerning/> <w:DontFlipMirrorIndents/> <w:OverrideTableStyleHps/> </w:Compatibility> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/> <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/> <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/> <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/> <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/> <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/> <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/> <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/> <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/> <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/> <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/> <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/> <w:LsdException Locked="false" Priority="37" Name="Bibliography"/> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";} </style> <![endif]--> <table class="MsoNormalTable" style="width:8.25in;border-collapse:collapse;mso-yfti-tbllook:1184;mso-padding-alt: 0in 0in 0in 0in" border="0" cellpadding="0" cellspacing="0" width="990"> <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:.25in"> <td colspan="2" style="width:74.85pt;padding: 0in 5.4pt 0in 5.4pt;height:.25in" nowrap="nowrap" valign="bottom" width="125"> Variables
</td> <td style="width:109.65pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="183">
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="110">
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="87">
</td> <td style="width:83.0pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="138">
</td> <td style="width:67.5pt;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="113">
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:.25in" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:1;height:15.0pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="40">
1.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="268"> Carbon
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="110"> 1
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="3" style="width:240.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="401"> 1 = Carbon, 2 = No Carbon
</td> </tr> <tr style="mso-yfti-irow:2;height:15.6pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.6pt" nowrap="nowrap" valign="bottom" width="40">
2.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.6pt" nowrap="nowrap" valign="bottom" width="268"> Capacity Rate Increase from:
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.6pt" nowrap="nowrap" valign="bottom" width="85">
$56.051
</td> <td style="width:66.0pt;border:solid windowtext 1.0pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.6pt" valign="bottom" width="110"> $ -
</td> <td style="width:52.0pt;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.6pt" valign="bottom" width="87"> $ 10.00
</td> <td style="width:83.0pt;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.6pt" valign="bottom" width="138"> $ 12.00
</td> <td style="width:67.5pt;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.6pt" valign="bottom" width="113"> $ 15.00
</td> <td style="width:1.25in;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.6pt" valign="bottom" width="150"> $ 27.34
</td> </tr> <tr style="mso-yfti-irow:3;height:15.0pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="40">
3.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="268"> Escalation CP Increase from:
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="85">
1.30%
</td> <td style="width:66.0pt;border:solid windowtext 1.0pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="110">
0.00%
</td> <td style="width:52.0pt;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="87">
1.10%
</td> <td style="width:83.0pt;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="138">
1.70%
</td> <td style="width:67.5pt;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="113">
2.00%
</td> <td style="width:1.25in;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:4;height:15.0pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="40">
4.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="268"> Energy Rate
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="85">
$0.01522
</td> <td style="width:66.0pt;border:solid windowtext 1.0pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="110"> $ -
</td> <td style="width:52.0pt;border-top:none;border-left: none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="87"> $0.00200
</td> <td style="width:83.0pt;border-top:none;border-left: none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="138">
$0.003679
</td> <td style="width:67.5pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="113">
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:5;height:.2in"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:.2in" nowrap="nowrap" valign="bottom" width="40">
5.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="268"> Escalation EP
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:.2in" nowrap="nowrap" valign="bottom" width="85">
1.01%
</td> <td style="width:66.0pt;border:solid windowtext 1.0pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="110">
0.00%
</td> <td style="width:52.0pt;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="87">
1.20%
</td> <td style="width:83.0pt;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="138">
1.99%
</td> <td style="width:67.5pt;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="113">
2.50%
</td> <td style="width:1.25in;border:solid windowtext 1.0pt; border-left:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:.2in" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:6;height:18.45pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:18.45pt" nowrap="nowrap" valign="bottom" width="40">
6.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:18.45pt" nowrap="nowrap" valign="bottom" width="268"> PH II MEM/UF
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:18.45pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:18.45pt" valign="bottom" width="110"> 1
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:18.45pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="2" style="width:150.5pt;padding: 0in 5.4pt 0in 5.4pt;height:18.45pt" nowrap="nowrap" valign="bottom" width="251"> 1 = No, 2 = Yes
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:18.45pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:7;height:16.2pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="40">
7.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:16.2pt" nowrap="nowrap" valign="bottom" width="268"> 10% Tax on Dividends
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:16.2pt" valign="bottom" width="110"> 1
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="2" style="width:150.5pt;padding: 0in 5.4pt 0in 5.4pt;height:16.2pt" nowrap="nowrap" valign="bottom" width="251"> 1 = No, 2 = Yes
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:8;height:16.2pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="40">
8.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:16.2pt" nowrap="nowrap" valign="bottom" width="268"> Sale of BP Unit
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:16.2pt" valign="bottom" width="110"> 1
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="2" style="width:150.5pt;padding: 0in 5.4pt 0in 5.4pt;height:16.2pt" nowrap="nowrap" valign="bottom" width="251"> 1 = No, 2 = Yes
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:16.2pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:9;height:15.0pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="40">
9.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="268"> Additional Costs Out
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="110"> 2
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="2" style="width:150.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="251"> 1 = No, 2 = Yes
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> <tr style="mso-yfti-irow:10;mso-yfti-lastrow:yes;height:15.0pt"> <td style="width:24.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="40">
10.
</td> <td colspan="2" style="width:160.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="268"> PH II Contingency
</td> <td style="width:51.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="85">
</td> <td style="width:66.0pt;border:double windowtext 2.25pt; border-top:none;background:#D5E7F2;padding:0in 5.4pt 0in 5.4pt;height:15.0pt" valign="bottom" width="110"> 1
</td> <td style="width:52.0pt;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="87">
</td> <td colspan="2" style="width:150.5pt;padding: 0in 5.4pt 0in 5.4pt;height:15.0pt" nowrap="nowrap" valign="bottom" width="251"> 2 = No, 2 = Yes
</td> <td style="width:1.25in;padding:0in 5.4pt 0in 5.4pt; height:15.0pt" nowrap="nowrap" valign="bottom" width="150">
</td> </tr> </tbody></table>



I can only get the code to go through 1 while loop and produce 256 lines of output vs. the 15,360. Please help. I know it must be an easy fix, but i've been staring at this for too long.

Here is my code (sorry if i'm posting this wrong):

Sub Calclate_Pre_Tax_IRR()
Dim Row As Integer
Dim Column As Integer
Dim Capacity_Rate_Increase As Double
Dim Energy_Rate_Increase As Double
Dim Capacity_Rate As Double
Dim Energy_Rate As Double
Dim Capacity_escalation_Increase As Double
Dim Energy_escalation_Increase As Double
Dim Capacity_escalation As Double
Dim Energy_escalation As Double
Dim Pre_Tax_IRR As Double
Dim Carbon As Integer
Dim PhII_MEM As Integer
Dim Tax_Dividend As Integer
Dim BP_Sale As Integer
Dim Additional_Cost As Integer
Dim PHII_Contingency As Integer
Dim Pre_Tax_IRR_Lever As Double
Dim Pre_Tax_IRR_UnLever As Double

Dim ColumnCapacity_Rate_Increase As Integer
Dim ColumnCapacity_escalation_Increase As Integer
Dim ColumnEnergy_Rate_Increase As Integer
Dim ColumnEnergy_escalation_Increase As Integer

'If i change the name of the output tab in the Excel file, I just need to change it here.
Dim OutputIterationsTab As String
OutputIterationsTab = "Output"

Row = 7


'Getting the values based on the input table
Do While Sheets("Total Cost").Cells(6, 33 + ColumnCapacity_Rate_Increase).Value <> ""
Capacity_Rate_Increase = Sheets("Total Cost").Cells(6, 33 + ColumnCapacity_Rate_Increase)
While Sheets("Total Cost").Cells(7, 33 + ColumnCapacity_escalation_Increase).Value <> ""
Capacity_escalation_Increase = Sheets("Total Cost").Cells(7, 33 + ColumnCapacity_escalation_Increase)
While Sheets("Total Cost").Cells(8, 33 + ColumnEnergy_Rate_Increase).Text <> ""
Energy_Rate_Increase = Sheets("Total Cost").Cells(8, 33 + ColumnEnergy_Rate_Increase).Value
While Sheets("Total Cost").Cells(9, 33 + ColumnEnergy_escalation_Increase).Text <> ""
Energy_escalation_Increase = Sheets("Total Cost").Cells(9, 33 + ColumnEnergy_escalation_Increase).Value

'Due to the change in the total project cost on these three variables:
'Ph II Con
'Ph II MEM
'Additional Cost
'The IRR will not be correctly calculated unless you run the Two Macros "Sources1()" and "Sources2a()"
'in order for the total equity required and total project cost to correct for the change. I tried putting the
' Sources1 and Sources2a after the three variables to compute the IRR at each point, but it didn't work out. Putting
'it right before the IRR is copied worked.
For Carbon = 1 To 2
For PhII_MEM = 1 To 2
For Tax_Dividend = 1 To 2
For BP_Sale = 1 To 2
For Additional_Cost = 1 To 2
For PHII_Contingency = 1 To 2

'Pasting the values into the correct part of the model for calculations
Sheets("Ph I Assumptions").Range("O9").FormulaR1C1 = Capacity_Rate_Increase
Sheets("Ph I Assumptions").Range("O10").FormulaR1C1 = Capacity_escalation_Increase
Sheets("Ph I Assumptions").Range("O11").FormulaR1C1 = Energy_Rate_Increase
Sheets("Ph I Assumptions").Range("O12").FormulaR1C1 = Energy_escalation_Increase

Sheets("Total Cost").Range("AG5").FormulaR1C1 = Carbon
Sheets("Total Cost").Range("AG10").FormulaR1C1 = PhII_MEM
Sheets("Total Cost").Range("AG11").FormulaR1C1 = Tax_Dividend
Sheets("Total Cost").Range("AG12").FormulaR1C1 = BP_Sale
Sheets("Total Cost").Range("AG13").FormulaR1C1 = Additional_Cost
Sheets("Total Cost").Range("AG14").FormulaR1C1 = PHII_Contingency

'Grab the calculated CP, CP escalation, EP, and EP escaltion from the Ph I Assumptions tab
'and put the values in the Output tab
Row = Row + 1

'This runs the Greentech Macros to correct for the Total Equity and Total project costs.
Sources1
Sources2a

'This grabs the IRR adn pastes it into the Output tab
Pre_Tax_IRR_Lever = Sheets("IRR").Range("G51").Value
Sheets(OutputIterationsTab).Range("P" & Row).FormulaR1C1 = Pre_Tax_IRR_Lever

Pre_Tax_IRR_UnLever = Sheets("IRR").Range("G29").Value
Sheets(OutputIterationsTab).Range("O" & Row).FormulaR1C1 = Pre_Tax_IRR_UnLever

Capacity_Rate = Sheets("Ph I Assumptions").Range("N9").Value
Sheets(OutputIterationsTab).Range("D" & Row).FormulaR1C1 = Capacity_Rate

Capacity_escalation = Sheets("Ph I Assumptions").Range("N10").Value
Sheets(OutputIterationsTab).Range("E" & Row).FormulaR1C1 = Capacity_escalation

Energy_Rate = Sheets("Ph I Assumptions").Range("N11").Value
Sheets(OutputIterationsTab).Range("F" & Row).FormulaR1C1 = Energy_Rate

Energy_escalation = Sheets("Ph I Assumptions").Range("N12").Value
Sheets(OutputIterationsTab).Range("G" & Row).FormulaR1C1 = Energy_escalation


Sheets(OutputIterationsTab).Range("H" & Row).FormulaR1C1 = PhII_MEM
Sheets(OutputIterationsTab).Range("I" & Row).FormulaR1C1 = Tax_Dividend
Sheets(OutputIterationsTab).Range("J" & Row).FormulaR1C1 = BP_Sale
Sheets(OutputIterationsTab).Range("K" & Row).FormulaR1C1 = Additional_Cost
Sheets(OutputIterationsTab).Range("L" & Row).FormulaR1C1 = PHII_Contingency
Sheets(OutputIterationsTab).Range("M" & Row).FormulaR1C1 = Carbon


Next 'PHII_Contingency
Next 'Additional_Cost
Next 'BP_Sale
Next 'Tax_Dividend
Next 'PhII_MEM
Next 'Carbon
ColumnEnergy_escalation_Increase = ColumnEnergy_escalation_Increase + 1
Wend
ColumnEnergy_Rate_Increase = ColumnEnergy_Rate_Increase + 1
Wend
ColumnCapacity_escalation_Increase = ColumnCapacity_escalation_Increase + 1
Wend
ColumnCapacity_Rate_Increase = ColumnCapacity_Rate_Increase + 1
Loop


End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I'm guessing you have to reset the column counters back to zero after each Wend or before each While. Otherwise they are stuck on an empty cell after the first pass.

Code:
    Do While Sheets("Total Cost").Cells(6, 33 + ColumnCapacity_Rate_Increase).Value <> ""
        Capacity_Rate_Increase = Sheets("Total Cost").Cells(6, 33 + ColumnCapacity_Rate_Increase)
       [COLOR="Red"] ColumnCapacity_escalation_Increase = 0[/COLOR]
        While Sheets("Total Cost").Cells(7, 33 + ColumnCapacity_escalation_Increase).Value <> ""
            Capacity_escalation_Increase = Sheets("Total Cost").Cells(7, 33 + ColumnCapacity_escalation_Increase)
            [COLOR="Red"]ColumnEnergy_Rate_Increase = 0[/COLOR]
            While Sheets("Total Cost").Cells(8, 33 + ColumnEnergy_Rate_Increase).Text <> ""
                Energy_Rate_Increase = Sheets("Total Cost").Cells(8, 33 + ColumnEnergy_Rate_Increase).Value
                [COLOR="Red"]ColumnEnergy_escalation_Increase = 0[/COLOR]
                While Sheets("Total Cost").Cells(9, 33 + ColumnEnergy_escalation_Increase).Text <> ""
                    Energy_escalation_Increase = Sheets("Total Cost").Cells(9, 33 + ColumnEnergy_escalation_Increase).Value
 
Last edited:
Upvote 0
Thank YOU SOO MUCH! That was the issue!

It's working great now and will take another few hours to compute them all.

thank you again!!
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top