![]() |
Trim function in Excel Doesn't work for certain cells
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. |
Trim function in Excel Doesn't work for certain cells
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 -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. -------------------------------------------------------------------------------------------------------------- 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. |
All times are GMT +1. The time now is 07:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com