#1   Report Post  
aftamath
 
Posts: n/a
Default Special Characters

I'm having problems with Special Characters. When I cut and paste a list
from an email that has been spaced with tabbing, the tabbed spaces show up as
special characters called non-breaking spaces in Microsoft Word, and I don't
know what they show up as in Excel after cut and paste. The Trim code I have
in VBA doesn't recognize these spaces. How do I get excel or VBA to
recognize the characters?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default Special Characters

If they were tabs, then I don't think they'd be non-breaking spaces.

The tab character is =chr(9).
The non-breaking space in HTML is =chr(160).

Chip Pearson has a very nice addin that will help determine what that
character(s) is:
http://www.cpearson.com/excel/CellView.htm

If you do see a box, then you can either fix it via a helper cell or a macro:

=substitute(a1,char(9),"")
or
=substitute(a1,char(9)," ")

or as a macro (after using Chip's CellView addin):

Option Explicit
Sub cleanEmUp()

Dim myBadChars As Variant
Dim myGoodChars As Variant
Dim iCtr As Long

myBadChars = Array(Chr(9), Chr(160)) '<--What showed up in CellView?

myGoodChars = Array(" "," ") '<--what's the new character?

If UBound(myGoodChars) < UBound(myBadChars) Then
MsgBox "Design error!"
Exit Sub
End If

For iCtr = LBound(myBadChars) To UBound(myBadChars)
ActiveSheet.Cells.Replace What:=myBadChars(iCtr), _
Replacement:=myGoodChars(iCtr), _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False
Next iCtr

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


aftamath wrote:

I'm having problems with Special Characters. When I cut and paste a list
from an email that has been spaced with tabbing, the tabbed spaces show up as
special characters called non-breaking spaces in Microsoft Word, and I don't
know what they show up as in Excel after cut and paste. The Trim code I have
in VBA doesn't recognize these spaces. How do I get excel or VBA to
recognize the characters?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight special (dis-allowed) characters in a worksheet Jack Excel Discussion (Misc queries) 1 September 22nd 05 01:31 PM
Special Characters on Labels BillCPA Excel Discussion (Misc queries) 7 May 12th 05 02:46 PM
excel data label format special number characters (part 2) todd Excel Discussion (Misc queries) 1 May 4th 05 04:08 PM
REMOVE SPECIAL CHARACTERS FROM TEXT CELLS javila255 Excel Worksheet Functions 1 April 2nd 05 06:24 PM
Special Characters in Headers and Footers LPS Excel Discussion (Misc queries) 5 February 26th 05 06:02 PM


All times are GMT +1. The time now is 02:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"