how to 3.3 to 3.30

Posted on 1998-06-21
Last Modified: 2010-05-03
A variable displays 3.3 and I want 3.30 or always 2 decimals
Question by:harryq

Accepted Solution

dirtdart earned 30 total points
ID: 1463885
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"


Expert Comment

ID: 1463886
Dim N as single, NOut as string

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



Author Comment

ID: 1463887
Both  samples work.


Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now