PDA

View Full Version : display negative values as $0.00



av8tordude
01-17-2011, 12:14 PM
This code is subtracting one value with another, but if the results are negative, how can I display the value as $0.00?

frmPDCalc.DL8B.Caption = Format(CCur(Replace(Replace(frmPDCalc.EL6B.Caption, "$", ""), ",", "")) - CCur(Replace(frmPDCalc.Test7B.Caption, "*", "")), "$##,###0.00")

Paul_Hossler
01-17-2011, 01:15 PM
The format string

"$##,###0.00";$0.00;$0.00"

should work

Paul

Artik
01-17-2011, 02:00 PM
For example MsgBox Format(Application.Max(2.3567 - 3.9834, 0), "$##,###0.00")
MsgBox Format(Application.Max(10.3567 - 3.9834, 0), "$##,###0.00")
MsgBox Format(Application.Max(2.3567 - 2.3567, 0), "$##,###0.00")

Artik