Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ket
 
Posts: n/a
Default Replace double spaces with Hard return

Hello,

I am using Excel 2003. I have a column of names, format first name
last name.
After each last name there are two spaces and then there is another
first name last name.
This carries on in most of the cells in the column.
Is it possible to replace the double space with a hard return?

Thanks in advance for your help.

Ket
London,UK
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Replace double spaces with Hard return

Ket -

· Highlight the column that you want to change.
· Press Ctrl-H to bring up the Find/Replace dialog box
· In the Find What box, press space bar twice
· In the Replace With box, hold down the Alt key and type 0010 on the
number pad (NOTE: You will not see anything entered in the Replace With
box.)
· Click Replace All and you should be done.

- John Michl



Ket wrote:
Hello,

I am using Excel 2003. I have a column of names, format first name
last name.
After each last name there are two spaces and then there is another
first name last name.
This carries on in most of the cells in the column.
Is it possible to replace the double space with a hard return?

Thanks in advance for your help.

Ket
London,UK


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ket
 
Posts: n/a
Default Replace double spaces with Hard return

John,

Thanks for your prompt reply. Another teaser for you. If there are an
unknown number of spaces between the last name and first name. Is
there a way of searching for any spaces greater than 2 and placing the
hard retrun just in front of the next first name?

Hope this makes sense.




On 26 Jun 2006 06:46:55 -0700, "John Michl"
wrote:

Ket -

· Highlight the column that you want to change.
· Press Ctrl-H to bring up the Find/Replace dialog box
· In the Find What box, press space bar twice
· In the Replace With box, hold down the Alt key and type 0010 on the
number pad (NOTE: You will not see anything entered in the Replace With
box.)
· Click Replace All and you should be done.

- John Michl



Ket wrote:
Hello,

I am using Excel 2003. I have a column of names, format first name
last name.
After each last name there are two spaces and then there is another
first name last name.
This carries on in most of the cells in the column.
Is it possible to replace the double space with a hard return?

Thanks in advance for your help.

Ket
London,UK


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Replace double spaces with Hard return

Ket - I'm not aware of a simple way to do this without executing the
Find/Replace routine several times. With that said, the macro below
does just that. I'll assume you know how to create a module and copy
the macro to that module. Then in your spreadsheet, select the column
of data, press Alt-F8 and run the macro.

If you expect more than 10 consecutive spaces, change the 10 in the
first line to the highest possible number. Hope that helps.

- John



Sub ReplaceSpaces()

For i = 10 To 2 Step -1
' Create a search string of spaces
s = WorksheetFunction.Rept(" ", i)

Selection.Replace What:=s, _
Replacement:="" & Chr(10) & "", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,_
ReplaceFormat:=False
Next i

End Sub






Ket wrote:
John,

Thanks for your prompt reply. Another teaser for you. If there are an
unknown number of spaces between the last name and first name. Is
there a way of searching for any spaces greater than 2 and placing the
hard retrun just in front of the next first name?

Hope this makes sense.




On 26 Jun 2006 06:46:55 -0700, "John Michl"
wrote:

Ket -

· Highlight the column that you want to change.
· Press Ctrl-H to bring up the Find/Replace dialog box
· In the Find What box, press space bar twice
· In the Replace With box, hold down the Alt key and type 0010 on the
number pad (NOTE: You will not see anything entered in the Replace With
box.)
· Click Replace All and you should be done.

- John Michl



Ket wrote:
Hello,

I am using Excel 2003. I have a column of names, format first name
last name.
After each last name there are two spaces and then there is another
first name last name.
This carries on in most of the cells in the column.
Is it possible to replace the double space with a hard return?

Thanks in advance for your help.

Ket
London,UK


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find replace text or symbol with carriage return jo New Users to Excel 11 April 4th 23 10:41 AM
How do I make a hard return within a cell in Excel? Rose49 New Users to Excel 1 September 27th 05 02:32 PM
How do I insert a "hard return" in a cell? cari Excel Discussion (Misc queries) 1 July 5th 05 06:22 PM
Is is possible to add a hard return to a merge cell formula? Nmo11 Excel Discussion (Misc queries) 4 April 5th 05 05:47 PM
hard return alphadog47 New Users to Excel 2 February 26th 05 08:38 PM


All times are GMT +1. The time now is 12:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"