?
Solved

String to number

Posted on 2004-09-06
4
Medium Priority
?
178 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 1600 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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.
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…
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

770 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