Consulting

Results 1 to 3 of 3

Thread: display negative values as $0.00

  1. #1

    display negative values as $0.00

    This code is subtracting one value with another, but if the results are negative, how can I display the value as $0.00?

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

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    The format string

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

    should work

    Paul

  3. #3
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    For example[VBA] 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")[/VBA]

    Artik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •