Solved

String to number

Posted on 2004-09-06
4
173 Views
Last Modified: 2010-05-02
Hi:
     Given the following string :

"$80.00"

I need to add this string to a number. I have tried using the Val function but I get a zero because of the dollar sign. Is there another function or procedure that I could use to covert the string to a number?

0
Comment
Question by:LearningJava
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
mladenovicz earned 400 total points
ID: 11990978
try
val(Replace("$80.00","$",""))
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11990999
also, you can try CCur("$80.00")
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11991061
Oops I meant Cint("$80.00")
0
 
LVL 14

Expert Comment

by:aelatik
ID: 11991197
You could use FormatNumber ( It will handle the decimals correctly that way )

x = FormatNumber("$80.50", 2) ' the 2 stands for nums after digit
MsgBox x
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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.
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…
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…

860 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