Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Value is not displayed on the screen
When I do this coding in VBA:
================================================== ======= If txtDmdPeak.Text <= txtDtotal.Text Then 'Firm - Normal Bill If Answer = True Then If txtCalculatedDemand.Text < txtDsbf.Text Then txtFirmStandbyCharge.Text = (txtDsbf.Value - txtCalculatedDemand.Value) * txtMaxDmcFirm.Value If txtFirmStandbyCharge.Value = "" Then txtFirmStandbyCharge.Value = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If If txtDsbf.Text < txtCalculatedDemand.Text Then If txtCalculatedDemand.Text < txtDtotal.Text Then txtFirmStandbyCharge.Text = (txtDtotal.Value - txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value If txtFirmStandbyCharge.Text = "" Then txtFirmStandbyCharge.Text = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If End If ================================================== ====== It does not display the results on the screen for this particular textbox. Is there anything wrong with the properties which I set? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Value is not displayed on the screen
It may be that your text does not display if the
conditions don't satisfy your conditions. I see at least TWO missing ELSE staements where you would miss putting in values. Take a look at the following - I made one small adjustment, and included the two missing else's - you can fill the missing code... If txtDmdPeak.Text <= txtDtotal.Text Then 'Firm - Normal Bill If Answer = True Then If txtCalculatedDemand.Text < txtDsbf.Text Then txtFirmStandbyCharge.Text = (txtDsbf.Value - txtCalculatedDemand.Value) * txtMaxDmcFirm.Value If txtFirmStandbyCharge.Value = "" Then txtFirmStandbyCharge.Value = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If Else ' I changed from your code ' why use IF here?? If txtCalculatedDemand.Text < txtDtotal.Text Then _ txtFirmStandbyCharge.Text = (txtDtotal.Value - txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value If txtFirmStandbyCharge.Text = "" Then txtFirmStandbyCharge.Text = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If Else '???? End If End If Else '????? Not normal bill End If Patrick Molloy Microsoft Excel MVP -----Original Message----- When I do this coding in VBA: ================================================= ======== If txtDmdPeak.Text <= txtDtotal.Text Then 'Firm - Normal Bill If Answer = True Then If txtCalculatedDemand.Text < txtDsbf.Text Then txtFirmStandbyCharge.Text = (txtDsbf.Value - txtCalculatedDemand.Value) * txtMaxDmcFirm.Value If txtFirmStandbyCharge.Value = "" Then txtFirmStandbyCharge.Value = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If If txtDsbf.Text < txtCalculatedDemand.Text Then If txtCalculatedDemand.Text < txtDtotal.Text Then txtFirmStandbyCharge.Text = (txtDtotal.Value - txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value If txtFirmStandbyCharge.Text = "" Then txtFirmStandbyCharge.Text = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If End If ================================================= ======= It does not display the results on the screen for this particular textbox. Is there anything wrong with the properties which I set? Thanks. . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Value is not displayed on the screen
Hello,
That was quite helpful but I have a question here. What is max condition can u have in an If...Else Statement. I have four conditions. How do I apply the if...else statement on this conditions? As what I know and have tried, in an if..else statement, we can only have one "else if" and one "else" within the structure. I hope I'm not being confusing. Thanks. Sheela -----Original Message----- It may be that your text does not display if the conditions don't satisfy your conditions. I see at least TWO missing ELSE staements where you would miss putting in values. Take a look at the following - I made one small adjustment, and included the two missing else's - you can fill the missing code... If txtDmdPeak.Text <= txtDtotal.Text Then 'Firm - Normal Bill If Answer = True Then If txtCalculatedDemand.Text < txtDsbf.Text Then txtFirmStandbyCharge.Text = (txtDsbf.Value - txtCalculatedDemand.Value) * txtMaxDmcFirm.Value If txtFirmStandbyCharge.Value = "" Then txtFirmStandbyCharge.Value = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If Else ' I changed from your code ' why use IF here?? If txtCalculatedDemand.Text < txtDtotal.Text Then _ txtFirmStandbyCharge.Text = (txtDtotal.Value - txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value If txtFirmStandbyCharge.Text = "" Then txtFirmStandbyCharge.Text = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If Else '???? End If End If Else '????? Not normal bill End If Patrick Molloy Microsoft Excel MVP -----Original Message----- When I do this coding in VBA: ================================================ ======== = If txtDmdPeak.Text <= txtDtotal.Text Then 'Firm - Normal Bill If Answer = True Then If txtCalculatedDemand.Text < txtDsbf.Text Then txtFirmStandbyCharge.Text = (txtDsbf.Value - txtCalculatedDemand.Value) * txtMaxDmcFirm.Value If txtFirmStandbyCharge.Value = "" Then txtFirmStandbyCharge.Value = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If If txtDsbf.Text < txtCalculatedDemand.Text Then If txtCalculatedDemand.Text < txtDtotal.Text Then txtFirmStandbyCharge.Text = (txtDtotal.Value - txtCalculatedDemand.Value) * txtMaxDmcNonFirm.Value If txtFirmStandbyCharge.Text = "" Then txtFirmStandbyCharge.Text = "0" Else txtFirmStandbyCharge.Value = Format (txtFirmStandbyCharge.Value, "######.##") End If End If End If ================================================ ======== It does not display the results on the screen for this particular textbox. Is there anything wrong with the properties which I set? Thanks. . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
my excel sheet is not displayed but black screen appears | Excel Discussion (Misc queries) | |||
Setting hyperlinked cells to be displayed at the top of the screen | Excel Discussion (Misc queries) | |||
print box opens in right screen of dual screen setup why | Excel Discussion (Misc queries) | |||
Why do cells in Excel print shorter than displayed on-screen? | Excel Discussion (Misc queries) | |||
Amount of Data in a Cell Displayed On Screen/Print | Excel Discussion (Misc queries) |