Trim function in Excel Doesn't work for certain cells

N

Neeraja

Hi,

Could someone help me with this problem!

My Excel sheet has a Macro which has a procedure to
remove spaces from the cell value and insert in to
another Sheet.
Eg:My code is as simple as follows:

b = Sheets("ABC").Range("A5").value
Sheets("XYZ").Range("A1").value = Trim(b)

This Trim function removes forward and back spaces in
some Cells, but just ignores spaces in some Cells, and as
a result in the output i get some Cells with the Spaces
in the values.
I wonder if Excel has a variety of Spaces which are
different from each other, Because my Macro handles
certain spaces and ignores others???

I Appreciate any help.
Thanks,
Neeraja.
 
P

pfsardella

If you're trying to remove spaces between words, and on both ends.

Application.WoksheetFunction.Trim

--------------------------------------------------------------------------------------------------------------

I believe that space is Char 32.

http://www.rpi.edu/~kirkd/ascii/

--------------------------------------------------------------------------------------------------------------

Chip Person's CellView add-in allows you to see the exact characters
in a cell, as well as their character codes (in either decimal or hex
numbers).

http://www.cpearson.com/excel/cellview.htm

--------------------------------------------------------------------------------------------------------------

David McRitchie's Trimall macro helps to remove 'spaces' that aren't
really spaces.

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

HTH
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top