?
Solved

Need to remove period from number/currency

Posted on 2006-05-11
4
Medium Priority
?
194 Views
Last Modified: 2013-12-25
I'm using VB6.

I need a function to take the following currency values:

2
5.5
1.83
4.4444
5.67
5.5
1.9373

And return the following:

200
550
183
444
567
550
194

Any suggestions where to start?  I need to test for the location of the period and see how many digits are on the right side.  I don't care if they are rounded up or not.  To be off one cent in this case will not matter.
0
Comment
Question by:HKComputer
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 2000 total points
ID: 16662503
newNumber = Round(myNumber * 100)

S
0
 
LVL 20

Expert Comment

by:hes
ID: 16662987
Try this

Dim MyNumber As Double
MyNumber = 1.9373
MyNumber = Left((Replace(MyNumber, ".", "") * 100), 3)
0
 
LVL 4

Author Comment

by:HKComputer
ID: 16671530
Shauli, you are a genius.  I would have never thought of such a simple approach.  I have it installed and working well with your solution.  Thanks -HK
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16671701
You are most welcome :)

S
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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

807 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