1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Option Strict On
Option Explicit On
Module Module1
'Const FORMAT_DATEA As Date = CDate("dd/mm/yyyy")
Const FORMAT_CURRENCY As String = "#,###,###,##0.###############;(#,###,###,##0.###############)"
Function MonFormat(ByVal Value As Double, ByVal NbDec As VariantType) As String
Dim Dec As String
Dim F As String
Dec = ""
If Val(NbDec) = 0 Then
MonFormat = Format(CDec(Value), FORMAT_CURRENCY)
Else
If Val(NbDec) > 0 Then Dec = "." & String.Format(NbDec.ToString, "0")
F = "#,###,###,##0" & Dec & ";(#,###,###,##0" & Dec & ")"
MonFormat = Format(CDec(Value), F)
End If
End Function |
Partager