Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,075
- Office Version
- 2019
- Platform
- Windows
I using this code that formats the number as I type. I would like to make more dynamic to be able to choose the format base on a variable enter in another textbox. Currently the format is hard coded to two zeros after the decimal. I would like to enter (ex. 3) and the format would show $0.000
Any suggestions?
Thanks
Any suggestions?
Thanks
Code:
Dim v As String
Select Case Len(tbOPrice)
Case 1
tbOPrice = Format(tbOPrice, "$0\.00")
Case Is > 1
v = Replace(tbOPrice, "$", "")
v = Replace(v, ".", "")
tbOPrice = Format(CCur(v) / 100, "$#,#0.00")
Case Else
End Select
Last edited: