?
Solved

round off decimal number in vb 6

Posted on 2009-07-09
2
Medium Priority
?
527 Views
Last Modified: 2013-11-25
I want to round off..........not exactly round off.it should be trim.
I have a number:2.05012413. I want make it 2.0501. It should have only four digits after decimal.
how do I do it in Vb6?
0
Comment
Question by:SGUDAPAT
[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
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 2000 total points
ID: 24815504
If this is for display purposes, you can convert it to a string with Format

Format$( MyDecimalValue, "0.0000" );

If you want to actually change the value to round off to 4 decimals, use the Round function

MyDecimalValue = Round( MyDecimalValue, 4 )
0
 
LVL 1

Author Closing Comment

by:SGUDAPAT
ID: 31601665
Thank you.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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

719 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