Ananthak275
Board Regular
- Joined
- Aug 22, 2020
- Messages
- 128
- Office Version
- 2013
- Platform
- Windows
- MacOS
Hi, this is a build on the code from this page (Trim Column in VBA). The second line removes the leading, trailing and collapses multiple adjacent internal spaces down to single spaces. But i need to collapse all internal spaces which is why i added the 3rd line (using the replace function).
While this code works, I'm trying to see if there is a simpler way of being able to remove the leading, trailing and collapse all internal spaces down to zero?
While this code works, I'm trying to see if there is a simpler way of being able to remove the leading, trailing and collapse all internal spaces down to zero?
Addr = ColumnLetter & "2" & ":" & ColumnLetter & Cells(Rows.Count, ColumnLetter).End(xlUp).Row
Range(Addr) = Evaluate("IF(" & Addr & "="""","""",TRIM(" & Addr & "))")
ActiveSheet.Range(Addr).Replace ", ", ","