#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 788
Default Rows to columns

Hello,

I have a mailing list that is in rows rather than columns. Ie a complete
address takes up 4 rows in the same column.

Is there any way to columnize the data that I have to do a mail merge?

Chris


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 225
Default Rows to columns

Use the macro below;
It assumes your addresses are in Col A in Sheet1... this will write them in
Sheet2

Sub Transpose()
Dim srcSheet As String
Dim destSheet As String
Dim i, j, lastRow, step As Long

srcSheet = "Sheet1"
destSheet = "Sheet2"
step = 4

Worksheets(srcSheet).Activate

With Worksheets(srcSheet)
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

lastRow = (lastRow / step)
j = 1

For i = 1 To lastRow
Worksheets(srcSheet).Range("A" & j & ":A" & (j + step - 1)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets(destSheet).Cells(i, 1).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
j = j + step
Next i
End Sub
----------------------------
Procedure to run the macro
Open Excel and open the workbook with your data
Press ALT-F11 to open VB Editor
Choose Insert-Module
Paste the code
Press F5

Swich back to the workbook and verify the data in Sheet2...

"Chris" wrote:

Hello,

I have a mailing list that is in rows rather than columns. Ie a complete
address takes up 4 rows in the same column.

Is there any way to columnize the data that I have to do a mail merge?

Chris


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 788
Default Rows to columns

Thanks. I had to clean up my data a little and got the job done.

"Sheeloo" wrote:

Use the macro below;
It assumes your addresses are in Col A in Sheet1... this will write them in
Sheet2

Sub Transpose()
Dim srcSheet As String
Dim destSheet As String
Dim i, j, lastRow, step As Long

srcSheet = "Sheet1"
destSheet = "Sheet2"
step = 4

Worksheets(srcSheet).Activate

With Worksheets(srcSheet)
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

lastRow = (lastRow / step)
j = 1

For i = 1 To lastRow
Worksheets(srcSheet).Range("A" & j & ":A" & (j + step - 1)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets(destSheet).Cells(i, 1).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
j = j + step
Next i
End Sub
----------------------------
Procedure to run the macro
Open Excel and open the workbook with your data
Press ALT-F11 to open VB Editor
Choose Insert-Module
Paste the code
Press F5

Swich back to the workbook and verify the data in Sheet2...

"Chris" wrote:

Hello,

I have a mailing list that is in rows rather than columns. Ie a complete
address takes up 4 rows in the same column.

Is there any way to columnize the data that I have to do a mail merge?

Chris


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 do i paste rows/columns avoiding hidden rows/columns perezli Excel Discussion (Misc queries) 1 January 30th 09 03:58 PM
Excel 2003 - change columns to rows and rows to columns Trish Excel Discussion (Misc queries) 0 August 17th 07 02:22 AM
Excel 2003 - change columns to rows and rows to columns JLatham Excel Discussion (Misc queries) 0 August 17th 07 02:05 AM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
how to interchange rows to columns & columns to rows in a table kotakkamlesh Excel Discussion (Misc queries) 1 July 10th 06 07:58 AM


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