Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default moving cells

I have a spreadsheet with 1500 entries in one column A. Each entry consist
of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines to
columns b,c,d. and to delete the space between entries.

example:

John Doe
1234 lost street
Chicago, IL 60055
555-555-1212

Jane Doe
4321 Lost Street
Chicago, IL 60055
555-555-1212

changed to:

John Doe 1234 lost street Chicago, IL 60055 555-555-1212
Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default moving cells

Sub RearrangeData()
Dim rng As Range, ar As Range
Dim cell As Range, i As Long
Set rng = Columns(1).SpecialCells(xlConstants)
For Each ar In rng.Areas
i = 1
For Each cell In ar
If i < 1 Then
cell.Offset(-(i - 1), i - 1).Value = cell.Value
cell.ClearContents
End If
i = i + 1
Next cell
Next ar
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
End Sub

--
Regards,
Tom Ogilvy


"bryan" wrote in message
...
I have a spreadsheet with 1500 entries in one column A. Each entry consist
of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines
to
columns b,c,d. and to delete the space between entries.

example:

John Doe
1234 lost street
Chicago, IL 60055
555-555-1212

Jane Doe
4321 Lost Street
Chicago, IL 60055
555-555-1212

changed to:

John Doe 1234 lost street Chicago, IL 60055 555-555-1212
Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default moving cells

and what do I do with this jumble

"Tom Ogilvy" wrote:

Sub RearrangeData()
Dim rng As Range, ar As Range
Dim cell As Range, i As Long
Set rng = Columns(1).SpecialCells(xlConstants)
For Each ar In rng.Areas
i = 1
For Each cell In ar
If i < 1 Then
cell.Offset(-(i - 1), i - 1).Value = cell.Value
cell.ClearContents
End If
i = i + 1
Next cell
Next ar
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
End Sub

--
Regards,
Tom Ogilvy


"bryan" wrote in message
...
I have a spreadsheet with 1500 entries in one column A. Each entry consist
of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines
to
columns b,c,d. and to delete the space between entries.

example:

John Doe
1234 lost street
Chicago, IL 60055
555-555-1212

Jane Doe
4321 Lost Street
Chicago, IL 60055
555-555-1212

changed to:

John Doe 1234 lost street Chicago, IL 60055 555-555-1212
Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default moving cells

I am not a novice but never created a program in excel

"bryan" wrote:

and what do I do with this jumble

"Tom Ogilvy" wrote:

Sub RearrangeData()
Dim rng As Range, ar As Range
Dim cell As Range, i As Long
Set rng = Columns(1).SpecialCells(xlConstants)
For Each ar In rng.Areas
i = 1
For Each cell In ar
If i < 1 Then
cell.Offset(-(i - 1), i - 1).Value = cell.Value
cell.ClearContents
End If
i = i + 1
Next cell
Next ar
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
End Sub

--
Regards,
Tom Ogilvy


"bryan" wrote in message
...
I have a spreadsheet with 1500 entries in one column A. Each entry consist
of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines
to
columns b,c,d. and to delete the space between entries.

example:

John Doe
1234 lost street
Chicago, IL 60055
555-555-1212

Jane Doe
4321 Lost Street
Chicago, IL 60055
555-555-1212

changed to:

John Doe 1234 lost street Chicago, IL 60055 555-555-1212
Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default moving cells

Hi Bryan

Assuming there is no column A heading, try....

Sub Test()
Application.ScreenUpdating = False
With ActiveSheet
..Range("1:3").Insert Shift:=xlDown
..Range(.Range("A2"), .Range("A2").End(xlDown).Offset(-1, 0)).Delete
Shift:=xlUp
..Range("A:A").Copy .Range("B1:D1")
..Range("B1,C1:C2,D1:D3").Delete Shift:=xlUp
..Range("A:A").SpecialCells(xlCellTypeConstants, 23).Offset(1,
0).EntireRow.Delete
..Range("1:1").ClearContents
End With
Application.ScreenUpdating = True
End Sub

--

Regards

William

XL2003




"bryan" wrote in message
...
|I have a spreadsheet with 1500 entries in one column A. Each entry consist
| of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines
to
| columns b,c,d. and to delete the space between entries.
|
| example:
|
| John Doe
| 1234 lost street
| Chicago, IL 60055
| 555-555-1212
|
| Jane Doe
| 4321 Lost Street
| Chicago, IL 60055
| 555-555-1212
|
| changed to:
|
| John Doe 1234 lost street Chicago, IL 60055 555-555-1212
| Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default moving cells

right click the sheet tab and choose view code. if you don't see a code window,
double click the sheet name on the left under project
paste the code in the code window

then tools/macro/macros or ALT-8

and run the macro

--


Gary


"bryan" wrote in message
...
and what do I do with this jumble

"Tom Ogilvy" wrote:

Sub RearrangeData()
Dim rng As Range, ar As Range
Dim cell As Range, i As Long
Set rng = Columns(1).SpecialCells(xlConstants)
For Each ar In rng.Areas
i = 1
For Each cell In ar
If i < 1 Then
cell.Offset(-(i - 1), i - 1).Value = cell.Value
cell.ClearContents
End If
i = i + 1
Next cell
Next ar
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
End Sub

--
Regards,
Tom Ogilvy


"bryan" wrote in message
...
I have a spreadsheet with 1500 entries in one column A. Each entry consist
of 4 lines of data and a space. I need to move the 2nd, 3rd and 4th lines
to
columns b,c,d. and to delete the space between entries.

example:

John Doe
1234 lost street
Chicago, IL 60055
555-555-1212

Jane Doe
4321 Lost Street
Chicago, IL 60055
555-555-1212

changed to:

John Doe 1234 lost street Chicago, IL 60055 555-555-1212
Jane Doe 4321 lost street Chicago, IL 60055 555-555-1212






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 text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
Enter Key + Dragging Cells / Moving Cells Tim Excel Discussion (Misc queries) 2 September 24th 08 11:14 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Moving some cells. Metrazal[_22_] Excel Programming 5 March 3rd 06 06:08 PM
Cells(col,row) keep moving to lower case and I can not ref. a cells in a differnet sheet WayneL[_2_] Excel Programming 2 April 25th 05 11:27 PM


All times are GMT +1. The time now is 03:26 PM.

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

About Us

"It's about Microsoft Excel"