There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
audio avg avg 8 backup bios boot browser bsod computer cpu crash css desktop driver drivers dvd email error excel explorer firefox firefox 3 freeze game graphics hard drive hardware help please hijackthis hjt install internet internet explorer itunes javascript keyboard lan laptop malware missing monitor msn network networking openoffice outlook outlook 2003 outlook express php popups problem router screen seo slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp wireless word
Business Applications
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Business Applications >
Macro to remove irrogenous characters?


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
chris_uk_lad's Avatar
Junior Member with 7 posts.
 
Join Date: May 2008
11-May-2008, 11:46 AM #1
Macro to remove irrogenous characters?
Hi, i've been looking for some code that will remove unneccesary characters from an excel document, making it ripe for migration!

Characters in question are + signs and comma's but a universal one would be great!. Ive used a code before but my hard disk died a while back so lost forever

Any help would be greatly appreciated
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 5,796 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
11-May-2008, 01:26 PM #2
Won't Excel's "Find & Replace" do it for you?
chris_uk_lad's Avatar
Junior Member with 7 posts.
 
Join Date: May 2008
11-May-2008, 03:17 PM #3
yes but its time consuming as im wanting it to run through hundreds of records possibly which contains things like telephone numbers of foreign countrys (remove first +00) and ahost of other characters. Just thought there mightbe an easier way through a macro.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 5,796 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
12-May-2008, 05:49 AM #4
chris, if this is a long term job then yes it is worth building a Macro, if it just the one off then you will spend far more time on the macro than doing the removal manually.
You can in actual fact record what you are doing manually and that will give you the code, it will just need some refinement after that.
If you can't get that to work you really need to post an Example (Not real data) of what characters you want removed to get more help from us.
__________________
.
.
OBP
I do not give up easily
slurpee55's Avatar
Computer Specs
Distinguished Member with 3,280 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
12-May-2008, 02:34 PM #5
Chris, are you wanting to remove all commas and plus signs on the worksheet, or just in certain columns or what?
slurpee55's Avatar
Computer Specs
Distinguished Member with 3,280 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
12-May-2008, 02:41 PM #6
And after you do manage to get rid of them, you will probably have a lot of the numbers formatted as text. Take a look at Zack's code here (post 16) to convert them:
http://forums.techguy.org/business-a...ogether-2.html
jimr381's Avatar
Distinguished Member with 3,228 posts.
 
Join Date: Jul 2007
Location: 1313 Mockingbird Lane
Experience: 1 Child, so not much
12-May-2008, 04:54 PM #7
I think you were looking for the word erroneous and not erogenous(irrogenous).
slurpee55's Avatar
Computer Specs
Distinguished Member with 3,280 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
12-May-2008, 05:09 PM #8
aw jim, maybe in the UK....
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 3,302 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
12-May-2008, 07:15 PM #9
I'm with OBP here. For continued use, a macro would probably work well for you. You could setup your characters into an array, then loop through that array checking the current worksheet (or whatever targeted worksheet you had) and 'clean' your data.

Here is an example...

Code:
Public Sub RemoveCharacters(Optional wks As Worksheet)
    Dim arrChars() As Variant, i As Long
    arrChars = Array("+", ",", "+00", "#", "%")
    If wks Is Nothing Then
        If ActiveSheet Is Nothing Then Exit Sub
        Set wks = ActiveSheet
    End If
    For i = LBound(arrChars) To UBound(arrChars)
        wks.Cells.Replace arrChars(i), vbNullString
    Next i
End Sub

Sub CallMySubToCleanThisWorksheetUp()
    Call RemoveCharacters
End Sub

Sub CallMySubToCleanThisWorksheetUp2()
    Call RemoveCharacters(ActiveSheet)
End Sub
HTH
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:00 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.