nayone
New Member
- Joined
- Aug 2, 2006
- Messages
- 29
Hi I have a function in a workbook that reformats a number, taking out decimal place & replacing it with a comma:
MsgBox ReformatNumber((Sheet1.Cells(1, 1).Value))
& the function :
Private Function ReformatNumber(ByVal Num As Single) As String
ReformatNumber = Replace(Num, ".", ",")
End Function
now this works fine but I am trying to add zeros to the end so if a user enters 1 or 1.2 we get 1,00 & 1,20 not 1, & 1,2 as currently
I have tried Mid(Num, Trim(Len(Num)) -2 1, 1) = "." to identify items & then add zeros but the 'len' command always returns 4? within the function for any length of text??
any pointers as this ones in got me
thx
Alex
MsgBox ReformatNumber((Sheet1.Cells(1, 1).Value))
& the function :
Private Function ReformatNumber(ByVal Num As Single) As String
ReformatNumber = Replace(Num, ".", ",")
End Function
now this works fine but I am trying to add zeros to the end so if a user enters 1 or 1.2 we get 1,00 & 1,20 not 1, & 1,2 as currently
I have tried Mid(Num, Trim(Len(Num)) -2 1, 1) = "." to identify items & then add zeros but the 'len' command always returns 4? within the function for any length of text??
any pointers as this ones in got me
thx
Alex