mysticmario
Active Member
- Joined
- Nov 10, 2021
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
I have this block of code that suppose to change texbox value for example, from 1,5 into 1.5 but for some reason instead of getting 1.5 i get this: 45047,0
I thought it is fairly straight forward code, but apparently it's not.
Maybe someone can advise how to fix this or do it differently?
VBA Code:
Private Sub HoursCount_AfterUpdate()
Dim inputText As String
inputText = Me.HoursCount.Text
inputText = Replace(inputText, ",", ".")
' Format the number with one decimal place
inputText = Format(inputText, "0.0")
' Update the text box with the formatted number
Me.HoursCount.Text = inputText
End Sub
Maybe someone can advise how to fix this or do it differently?