Macro to transpose names, addresses

G

Guest

How do I record a macro to transpose over 100 names and addresses in column A
of a worksheet to separate columns for a mail merge set up? i.e., column B =
name, column C = street, etc. I can record the copy, paste special,
transpose action, but I need to repeat for each of the 100 names, addresses,
incrementing down 3 rows to copy the next address and then down 1 row to
transpose/paste that address in columnar mail merge format.
 
G

Gord Dibben

Dave

Sub ColtoRows()
Dim Rng As Range
Dim I As Long
Dim j As Long
Dim nocols As Long
Set Rng = Cells(Rows.Count, 1).End(xlUp)
j = 1
On Error Resume Next
nocols = InputBox("Enter Number of Columns Desired")

For I = 1 To Rng.Row Step nocols
Cells(j, "A").Resize(1, nocols).Value = _
Application.Transpose(Cells(I, "A").Resize(nocols, 1))
j = j + 1
Next
Range(Cells(j, "A"), Cells(Rng.Row, "A")).ClearContents

End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top