Hi Chuck,
You might find that the TrimALL macro serves a more general purpose
in fixing up such data, and may help with some types of reentry problems
where you change the cell format before running the macro -- the TrimALL
macro will only work on text cells (a cell with 160 non-breaking space code is text)..
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
In any case, I prefer macros to work on a selection (selection.) instead
of on all cells (cells.) as being more generic as it is simple to select all
cells before running a macro, so you can use the same macro for both.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
"CLR" wrote ...
Very nice Tom.........I snagged your code for my own evil purposes elsewhere
"Tom Ogilvy" wrote:
Try running this macro:
Sub CleanData()
Cells.Replace What:=Chr(160), _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End Sub
these cell probably contain the non breaking space character (char 160).
--
Regards,
Tom Ogilvy
"Claus Massmann" wrote:
i have copied data from a website and would like to apply certain formulas to
it, but the data has 2 blank spaces after the last digit and therefore
formulas are not working.
I've tried trim, clean and neither are working.
Can anyone help?
Thanks