+ Reply to Thread
Results 1 to 7 of 7

VBA removing special characters

  1. #1
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    VBA removing special characters

    I want to write a macro that will remove the special characters from column A and move the results to column B. Below is my task and my expected results in red:

    Task Result
    &Tim Tim
    Lance**^ Lance
    Amory Amory
    Edy Edy
    Frank Frank
    Jack$!^ Jack
    Mary 4* Mary 4
    Matt!@ Matt
    Sindy%^ Sindy
    Saddy%is Saddyis

    The result of what I wanted is in red.
    I have started it but a bit confused. Below is my code so far. Please note that the data is more than 200 rows. I will appreciate it if someone helps me out. Thanks in advance for your time.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,756

    Re: VBA removing special characters

    Your examples all show the special characters either at the beginning or end of the string. Is that always true? If so you can use this change:

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: VBA removing special characters

    This seems to do what you want...
    Please Login or Register  to view this content.

    Usage:
    B1: =CleanChars(A1)

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: VBA removing special characters

    @6StringJazzer :The special characters appear both within the text, beginning and the end also. Is there a way I can modify the code to take care of that? I tried to put your piece of code but not getting any results in column B. Is there a way to modify my code?

    Please Login or Register  to view this content.
    Last edited by vnzerem; 01-21-2014 at 11:47 AM.

  5. #5
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: VBA removing special characters

    @Ron Coderre:
    Thanks a lot it works great with the functions. I appreciate it a lot. You guys Rock!!
    Last edited by vnzerem; 01-21-2014 at 11:40 AM.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: VBA removing special characters

    Try this:
    Please Login or Register  to view this content.
    Does that help?

  7. #7
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: VBA removing special characters

    @Ron Coderre: Perfect!!!! That's exactly what I needed!!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula for removing special characters.
    By alexgempesaw in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-15-2013, 01:31 AM
  2. Replies: 4
    Last Post: 11-17-2012, 04:42 AM
  3. Removing Duplicates and adding special characters
    By dawsonsoo in forum Excel General
    Replies: 7
    Last Post: 10-12-2011, 02:49 PM
  4. Consolidating VB code (Removing 29 different Special Characters)
    By adgjqetuo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2009, 07:25 AM
  5. Removing special characters in a text cell
    By Darrell in forum Excel General
    Replies: 0
    Last Post: 03-30-2005, 08:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1