?
Solved

Rounding

Posted on 2004-04-06
8
Medium Priority
?
203 Views
Last Modified: 2011-10-03
Hello,

Can you please tell me how I can round the numeric contents of a text box to two decimal places?  I presume I would first need to convert the contents of the text box into a double variable...

Thanks in advance for your reply,
Glenn Houston.
0
Comment
Question by:glennston
[X]
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
8 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 400 total points
ID: 10768657
Private Sub Command1_Click()
   MsgBox FormatNumber("120.5264", 2)
End Sub

S
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 10768674
CDbl(Fix(text1.text, 2))
0
 
LVL 19

Expert Comment

by:Shauli
ID: 10768689
Or with your textbox:

Private Sub Command1_Click()
   MsgBox FormatNumber(Text1.Text, 2)
End Sub

S

0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 10769529
Private Sub Command1_Click()
MsgBox Format(Text1.Text, "0.00")
End Sub

could always do that too =\
0
 
LVL 6

Expert Comment

by:PhilAI
ID: 10800874
Well, give someone the points?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

752 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