Thread: Space in text
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Space in text

If a one-time operation see the other reply about using TRIM function by
formula.

If an on-going problem use this macro on the selection.

Sub TRIM_EXTRA_SPACES()
Dim Cell As Range
For Each Cell In Selection
If (Not IsEmpty(Cell)) And _
Not IsNumeric(Cell.Value) And _
InStr(Cell.Formula, "=") = 0 _
Then Cell.Value = Application.Trim(Cell.Value)
Next
End Sub


Gord Dibben MS Excel MVP

On Sat, 10 May 2008 16:31:01 -0700, Raj wrote:

when I copy text from on sheet to anoth, the destination after the paste has
one space in front of the text. how do i remove the space from multiple cells
at the same time