View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
James Kendall James Kendall is offline
external usenet poster
 
Posts: 13
Default Removing Spaces within text

So how do you remove a space from an end of a string.

I need if a string ends with a space. Delete/remove it.
If string has a character other than a spac,e leave it alone.
--
Thank you for your time.
Windows XP
Office 2002


"BlaiseW" wrote:

Hi Karen,

The code below should sort out your problem:
Columns("I:I").Select
Range("I57").Activate
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Where "I:I" is the column containing your data.

Hope it helps.

Cheers
Blaise

"KAREN27" wrote:

Hi All,

I need to write some code to solve this problem.

I have a column of entries that I need to search through, and if it finds
any cells that have entries with a space - then remove the space and join
together the text on either side of the space.

For example:

abc123
def 456
ghi 789 jkl

... the result in the column would then be

abc123
def456
ghi789jkl

Thanks very much for your help
Karen