473,511 Members | 16,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

remove special characters from a cell in VB6

2 New Member
I need to remove special characters from a cell .The cell value is $1,234.50.
I want 1234.50 as result .
Pls help me.

regards,
5star
Jul 21 '07 #1
3 3978
Killer42
8,435 Recognized Expert Expert
I need to remove special characters from a cell .The cell value is $1,234.50.
I want 1234.50 as result.
Some questions for you...
  • As far as VB6 is concerned, what is a "cell"? I'm guessing maybe this has something to do with an Excel worksheet?
  • What have you attempted so far?
  • How certain are you that the dollar sign and comma are actually stored in the cell? Perhaps the cell simply holds a number, but is displaying it in a nicely-formatted way.
Jul 21 '07 #2
5star
2 New Member
I have to format a excel sheet using VB, in which a column in excel consists of amount in the format $1,234.50 . I need to format it by removing $ and , so that i will get 1234.50 value.

i tried the following syntax:

xlsheet.Cells(1, 1).NumberFormat = "text"

Error I got is :Application-defined or object-defined error.

Pls help me to get out of this pblm.
Jul 22 '07 #3
Killer42
8,435 Recognized Expert Expert
I don't think changing the number format will help, because it isn't a number to start with. How about setting .Value to Cleaned(.Value). And in a module somewhere, add this function...

Expand|Select|Wrap|Line Numbers
  1. Public Function Cleaned(ByVal Src As String) As String
  2.   Dim L As Long, I As Long, Char As String * 1
  3.   L = Len(Src)
  4.   For I = 1 To L
  5.     Char = Mid$(Src, I, 1)
  6.     Select Case Char
  7.       Case "0" To "9", "."
  8.         Cleaned = Cleaned & Char
  9.     End Select
  10.   Next
  11. End Function
This will take the value and strip off everything except numeric digits and full stops. I have no idea what will happen if the cell already contains a number. You can find that out for yourself. :)
Jul 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
8957
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
1
1414
by: Michael Hill | last post by:
I have a number of scripts that take special characters and convert them to their ascii equivalents and them store them in the database. However I am running into a problem that I have some of...
18
23416
by: prasanna.hariharan | last post by:
Hi guys, I want to remove certain words from a c++ string. The list of words are in a file with each word in a new line. I tried using the std::transform, but it dint work. Anybody got a clue...
5
9139
by: Jain, Pranay Kumar | last post by:
Hello Everyone, I have written a simple app. that converts the dataset into excelspreadsheet. The App. uses the following architecture. First it generates the dataset with corresponding...
5
8602
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
1
4554
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
4
23788
by: feucos | last post by:
Hi all, I am new to these so plz never mind if this is funny. here is my problem : Table : moody Column : Title
11
14845
by: cody | last post by:
Is there a method to replace special characters like Ä (A-Umlaut) with A, Ö (O-Umlaut) with O, and so on? Sure, I could look for each character separately and replace it with its...
3
10177
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.