how to 3.3 to 3.30

A variable displays 3.3 and I want 3.30 or always 2 decimals
harryqAsked:
Who is Participating?
 
dirtdartConnect With a Mentor Commented:
You would have to assign the number to a string and check the length after the decimal to be able to do that.

Dim sTemp As String
Dim iTemp As Integer

sTemp = "3.3"

iTemp = InStr(sTemp, ".")

If Len(sTemp) - iTemp < 2 Then sTemp = sTemp & "0"


0
 
murraywCommented:
Dim N as single, NOut as string

NOut = Format$(N, "###,##0.00")

                              Murrayw



0
 
harryqAuthor Commented:
Both  samples work.

0
All Courses

From novice to tech pro — start learning today.