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.
.
.
|