by Hayrina / Tukey (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 24th December 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Real time currency formating
API Declarations
Add a new Module and Copy + Paste
Dim xTotal As String
xTotal = Replace(Replace(xName, ",", ""), ".", "")
If Len(xTotal) = 1 Then
xTotal = ",0" & xTotal
ElseIf Len(xTotal) = 2 Then
xTotal = "," & xTotal
ElseIf Len(xTotal) > 2 Then
xTotal = Left(xTotal, Len(xTotal) - 2) & "," & Right(xTotal, 2)
End If
xName = Format(xTotal, "#,##0.00")
xName.SelStart = Len(xName)
End Sub