Solved

String to number

Posted on 2004-09-06
4
177 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
[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
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 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