ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cleaning Text (https://www.excelbanter.com/excel-programming/282902-cleaning-text.html)

James[_14_]

Cleaning Text
 
Hi All

Is it possible to Clean up the whole sheet at once.
i.e Apply TRIM & CLEAN function to all cells to get rid of
obious mess.
Also to Clean are internal spaces i.e Some cells might
have more then one space beween the values
e.g "Joe Doe Bill" to make it "Joe Doe Bill" with
one space only

Thanks you guys

James



Tom Ogilvy

Cleaning Text
 
No, you have to loop

Dim cell as Range
On Error Resume Next
for each cell in
Activesheet.UsedRange.specialCells(xlconstants,xlT extValues)
cell.Value = Application.Clean(application.Trim(cell))
Next
On Error goto 0
--
Regards,
Tom Ogilvy

"James" wrote in message
...
Hi All

Is it possible to Clean up the whole sheet at once.
i.e Apply TRIM & CLEAN function to all cells to get rid of
obious mess.
Also to Clean are internal spaces i.e Some cells might
have more then one space beween the values
e.g "Joe Doe Bill" to make it "Joe Doe Bill" with
one space only

Thanks you guys

James






All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com