Manolocs
Active Member
- Joined
- Mar 28, 2008
- Messages
- 340
I have no idea why this happens, I already followed threads from this forum and use the following formulas and macros but still can not get ride of the spaces in front of the cells
Any help is more than welcome.
=TRIM(A1)
=SUBSTITUTE(A1,CHAR(160),"")
=TRIM(SUBSTITUTE(D1,CHAR(160),CHAR(32)))
Any help is more than welcome.
=TRIM(A1)
=SUBSTITUTE(A1,CHAR(160),"")
=TRIM(SUBSTITUTE(D1,CHAR(160),CHAR(32)))
Code:
Sub RemoveLeadingSpace()
'Updateby20131129
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
Rng.Value = VBA.LTrim(Rng.Value)
Next
End Sub
Last edited by a moderator: