Skip to content

Commit

Permalink
Restored NumberToPrint to work with DRAGON coding (added additional o…
Browse files Browse the repository at this point in the history
…ption to add commas)
  • Loading branch information
shapiromatron committed Nov 29, 2011
1 parent a203d63 commit 930e162
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions VBA/z_numeric.bas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Enum NumberPrintReturnType
ReturnFormat = 2
End Enum

Function NumberToPrint(Number As Variant, ReturnType As NumberPrintReturnType) As Variant
Function NumberToPrint(Number As Variant, ReturnType As NumberPrintReturnType, ShowCommas As Boolean) As Variant
'---------------------------------------------------------------------------------------------------------
' NumberToPrint - Returns the number formatted or the format type
' - In : Number as Variant
Expand Down Expand Up @@ -41,9 +41,17 @@ Function NumberToPrint(Number As Variant, ReturnType As NumberPrintReturnType) A
Case Is > 100000
TextFormat = "0.0E+00"
Case Is > 10000
TextFormat = "0,000"
If ShowCommas = True Then
TextFormat = "0,000"
Else
TextFormat = "0000"
End If
Case Is > 1000 'and < 10,000
TextFormat = "0,000"
If ShowCommas = True Then
TextFormat = "0,000"
Else
TextFormat = "0000"
End If
Case Is > 100 'and < 1,000
TextFormat = "0"
Case Is > 10 'and < 100
Expand Down

0 comments on commit 930e162

Please sign in to comment.