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?

Improve company productivity with a Business Account.Sign Up

x
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.