Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


how to 3.3 to 3.30

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

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

dirtdart earned 120 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 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