Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Moving Part of Column

I have Heading = Last Name in Col A This column has a lot of names that contain (now xxxxx) which is their married name I would like to move all of the (now xxxxx) to Col B which has a heading of Married Name so that I can sort properly on Col A. Can this be done easily or do I have to do it one record at a time.

--

Regards
Michael Koerner


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Moving Part of Column

You can do this quite easily manually. Select the entire column and click Edit/Replace from the menu bar. Put " now " (without the quote marks... just make sure you have a blank space at the beginning and end of the text) into the "Find what" field, put any character that will never be found in a name (I am using the greater than symbol, ) into the "Replace with" field, click the "Options" button (note the double greater than symbol) to open the extra options and if there is a check mark in the "Match entire cell contents", remove it. Now click the "Replace All" button. Next, while the column is still selected, click Data/TextToColumns from the menu bar... click "Delimited" on Step 1, click "Other" and put the symbol () in the blank field next to it on Step 2 and then click the "Finish" button. And, if you want a macro to do all that, something like this should work...

Sub SplitOutMarriedNames()
Dim C As Range
For Each C In Range("A:A")
If InStr(1, C.Value, " now ", vbTextCompare) Then
C.Value = Replace(C.Value, " now ", "", , , vbTextCompare)
End If
Next
Range("A:A").TextToColumns Range("A1"), xlDelimited, , , _
False, False, False, False, True, ""
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
I have Heading = Last Name in Col A This column has a lot of names that contain (now xxxxx) which is their married name I would like to move all of the (now xxxxx) to Col B which has a heading of Married Name so that I can sort properly on Col A. Can this be done easily or do I have to do it one record at a time.

--

Regards
Michael Koerner


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Moving Part of Column

Rick;

Sorry, could not get either to work. I'm using Excel 2007 (should have mentioned that earlier) I guess it would have been easier if I said that I wanted to move from Col A what ever is in brackets (xxxxxx) including the brackets to Col B

--

Regards
Michael Koerner


"Rick Rothstein" wrote in message ...
You can do this quite easily manually. Select the entire column and click Edit/Replace from the menu bar. Put " now " (without the quote marks... just make sure you have a blank space at the beginning and end of the text) into the "Find what" field, put any character that will never be found in a name (I am using the greater than symbol, ) into the "Replace with" field, click the "Options" button (note the double greater than symbol) to open the extra options and if there is a check mark in the "Match entire cell contents", remove it. Now click the "Replace All" button. Next, while the column is still selected, click Data/TextToColumns from the menu bar... click "Delimited" on Step 1, click "Other" and put the symbol () in the blank field next to it on Step 2 and then click the "Finish" button. And, if you want a macro to do all that, something like this should work...

Sub SplitOutMarriedNames()
Dim C As Range
For Each C In Range("A:A")
If InStr(1, C.Value, " now ", vbTextCompare) Then
C.Value = Replace(C.Value, " now ", "", , , vbTextCompare)
End If
Next
Range("A:A").TextToColumns Range("A1"), xlDelimited, , , _
False, False, False, False, True, ""
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
I have Heading = Last Name in Col A This column has a lot of names that contain (now xxxxx) which is their married name I would like to move all of the (now xxxxx) to Col B which has a heading of Married Name so that I can sort properly on Col A. Can this be done easily or do I have to do it one record at a time.

--

Regards
Michael Koerner


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Moving Part of Column

Try this code...

Sub SplitOutMarriedNames()
Dim C As Range
Dim Bracket As Long
For Each C In Range("A:A")
Bracket = InStr(C.Value, "(")
If Bracket 0 Then
C.Offset(, 1).Value = Mid(C.Value, Bracket)
C.Value = RTrim(Left(C.Value, Bracket - 1))
End If
Next
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
Rick;

Sorry, could not get either to work. I'm using Excel 2007 (should have mentioned that earlier) I guess it would have been easier if I said that I wanted to move from Col A what ever is in brackets (xxxxxx) including the brackets to Col B

--

Regards
Michael Koerner


"Rick Rothstein" wrote in message ...
You can do this quite easily manually. Select the entire column and click Edit/Replace from the menu bar. Put " now " (without the quote marks... just make sure you have a blank space at the beginning and end of the text) into the "Find what" field, put any character that will never be found in a name (I am using the greater than symbol, ) into the "Replace with" field, click the "Options" button (note the double greater than symbol) to open the extra options and if there is a check mark in the "Match entire cell contents", remove it. Now click the "Replace All" button. Next, while the column is still selected, click Data/TextToColumns from the menu bar... click "Delimited" on Step 1, click "Other" and put the symbol () in the blank field next to it on Step 2 and then click the "Finish" button. And, if you want a macro to do all that, something like this should work...

Sub SplitOutMarriedNames()
Dim C As Range
For Each C In Range("A:A")
If InStr(1, C.Value, " now ", vbTextCompare) Then
C.Value = Replace(C.Value, " now ", "", , , vbTextCompare)
End If
Next
Range("A:A").TextToColumns Range("A1"), xlDelimited, , , _
False, False, False, False, True, ""
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
I have Heading = Last Name in Col A This column has a lot of names that contain (now xxxxx) which is their married name I would like to move all of the (now xxxxx) to Col B which has a heading of Married Name so that I can sort properly on Col A. Can this be done easily or do I have to do it one record at a time.

--

Regards
Michael Koerner


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 164
Default Moving Part of Column

Much appreciated, thanks Rick

--

Regards
Michael Koerner


"Rick Rothstein" wrote in message ...
Try this code...

Sub SplitOutMarriedNames()
Dim C As Range
Dim Bracket As Long
For Each C In Range("A:A")
Bracket = InStr(C.Value, "(")
If Bracket 0 Then
C.Offset(, 1).Value = Mid(C.Value, Bracket)
C.Value = RTrim(Left(C.Value, Bracket - 1))
End If
Next
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
Rick;

Sorry, could not get either to work. I'm using Excel 2007 (should have mentioned that earlier) I guess it would have been easier if I said that I wanted to move from Col A what ever is in brackets (xxxxxx) including the brackets to Col B

--

Regards
Michael Koerner


"Rick Rothstein" wrote in message ...
You can do this quite easily manually. Select the entire column and click Edit/Replace from the menu bar. Put " now " (without the quote marks... just make sure you have a blank space at the beginning and end of the text) into the "Find what" field, put any character that will never be found in a name (I am using the greater than symbol, ) into the "Replace with" field, click the "Options" button (note the double greater than symbol) to open the extra options and if there is a check mark in the "Match entire cell contents", remove it. Now click the "Replace All" button. Next, while the column is still selected, click Data/TextToColumns from the menu bar... click "Delimited" on Step 1, click "Other" and put the symbol () in the blank field next to it on Step 2 and then click the "Finish" button. And, if you want a macro to do all that, something like this should work...

Sub SplitOutMarriedNames()
Dim C As Range
For Each C In Range("A:A")
If InStr(1, C.Value, " now ", vbTextCompare) Then
C.Value = Replace(C.Value, " now ", "", , , vbTextCompare)
End If
Next
Range("A:A").TextToColumns Range("A1"), xlDelimited, , , _
False, False, False, False, True, ""
End Sub

--
Rick (MVP - Excel)


"Michael Koerner" wrote in message ...
I have Heading = Last Name in Col A This column has a lot of names that contain (now xxxxx) which is their married name I would like to move all of the (now xxxxx) to Col B which has a heading of Married Name so that I can sort properly on Col A. Can this be done easily or do I have to do it one record at a time.

--

Regards
Michael Koerner


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
moving part of a column into another column notsogoodatexcel Excel Worksheet Functions 3 March 26th 09 07:14 AM
moving part of information from one cell to another... auntwanette Excel Worksheet Functions 1 November 15th 06 10:07 PM
Copying Part of a row down part of a column Not Excelling Excel Discussion (Misc queries) 3 January 6th 06 11:58 PM
Moving data from one part of a worksheet to another with a button [email protected] Excel Programming 2 December 30th 05 04:23 PM
Moving a sheet from a closed spreadsheet & making it part of an open one. mjwillyone[_9_] Excel Programming 3 December 29th 03 11:01 PM


All times are GMT +1. The time now is 06:36 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"