473,671 Members | 2,176 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 3992
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
8992
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, mainly because I need the ability to both create and extract zip-files. I've tried a couple of classes found here and there, and they all seem to have the same problem. I'm currently using PclZip (http://phpconcept.net/pclzip/) but even the...
1
1432
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 those fields are loaded to an array and inserted into cells dynamically. As an example the array would be: var my_array = , ]; Then I have some javascript that creates the cell and inserts the value
18
23444
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 as to how i should go about this. thanks a lot, Hp
5
9159
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 datatables(each datatable represents a worksheet).It uses an Xslt file to do the transformation of the xml (generate from dataset) and write the output xml into a xmltextwriter. The App converts the data into excel with almost all of the formatting
5
8612
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". Same file path containing special characters works fine in one machine, but doesn't work in other. I am using following API function to get short file path. Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As
1
4563
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, 2. Text checks for max. length of the field & whether the field is mandatory or optional Example:
4
23798
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
14875
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 ascii-counterpart, but there are also such special characters in French and Swedish and many other languages which I also want to catch. Is there a generic way to do it?
3
10192
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. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want to read some regular expression tutorial. See the end of the article for links to online resources....
0
8392
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8669
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.