+ Reply to Thread
Results 1 to 4 of 4

How can I delete unprintable characters using VBA in Excel?

  1. #1
    Registered User
    Join Date
    07-25-2005
    Posts
    6

    How can I delete unprintable characters using VBA in Excel?

    I want to delete unprintable characters in an Excel sheet using VBA. I've tried using the CLEAN function, but can't find the correct syntax to get it to work in VBA. Can anyone help?
    Thanks!

  2. #2
    K Dales
    Guest

    RE: How can I delete unprintable characters using VBA in Excel?

    Use WorksheetFunction.Clean(YourString) - for example, if you wanted to clean
    the text in cell A3 you would have:
    Range("A3").Value = WorksheetFunction.Clean(Range("A3").Value)
    --
    - K Dales


    "peterv" wrote:

    >
    > I want to delete unprintable characters in an Excel sheet using VBA.
    > I've tried using the CLEAN function, but can't find the correct syntax
    > to get it to work in VBA. Can anyone help?
    > Thanks!
    >
    >
    > --
    > peterv
    > ------------------------------------------------------------------------
    > peterv's Profile: http://www.excelforum.com/member.php...o&userid=25572
    > View this thread: http://www.excelforum.com/showthread...hreadid=471435
    >
    >


  3. #3
    Tom Ogilvy
    Guest

    Re: How can I delete unprintable characters using VBA in Excel?

    for each cell in Activesheet.UsedRange
    cell.Value = Application.Clean(cell.Value)
    Next


    Just note that if you are bringing in your data from a web page (for
    example), there may be characters that CLEAN doesn't clean.

    --
    Regards,
    Tom Ogilvy

    "peterv" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I want to delete unprintable characters in an Excel sheet using VBA.
    > I've tried using the CLEAN function, but can't find the correct syntax
    > to get it to work in VBA. Can anyone help?
    > Thanks!
    >
    >
    > --
    > peterv
    > ------------------------------------------------------------------------
    > peterv's Profile:

    http://www.excelforum.com/member.php...o&userid=25572
    > View this thread: http://www.excelforum.com/showthread...hreadid=471435
    >




  4. #4
    Gord Dibben
    Guest

    Re: How can I delete unprintable characters using VBA in Excel?

    See David McRitchie's TrimAll code.

    http://www.mvps.org/dmcritchie/excel/join.htm#trimall


    Gord Dibben Excel MVP


    On Wed, 28 Sep 2005 10:18:17 -0500, peterv
    <[email protected]> wrote:

    >
    >I want to delete unprintable characters in an Excel sheet using VBA.
    >I've tried using the CLEAN function, but can't find the correct syntax
    >to get it to work in VBA. Can anyone help?
    >Thanks!



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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