ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and transpose (https://www.excelbanter.com/excel-programming/360348-copy-transpose.html)

deemcm

Copy and transpose
 
Have a long list of entries. Each entry is the same with a name, address,
email etc. all in a column. Then the next entry is two lines down. How can
I copy all the entries and paste them transposing the columns and rows? I'm
sure I'll need a macro of some sort, but I'm rusty on macro making.

Tom Ogilvy

Copy and transpose
 
Assume your entries don't contain blank cells. and no listing is less than 3
rows.

Sub ProcessData()
Dim rng As Range, rng1 As Range
ActiveSheet.Copy After:=Worksheets(Worksheets.Count)
Range("A1").Select
If IsEmpty(ActiveCell) Then
ActiveCell.End(xlDown).Select
End If
Do While Not ActiveCell.Row = Rows.Count
Set rng = Range(ActiveCell.Offset(1, 0), ActiveCell.End(xlDown))
If rng.Count 8 Then
MsgBox "Data screwed up"
Exit Sub
End If
rng.Copy
Set rng1 = ActiveCell
ActiveCell.Offset(0, 1).PasteSpecial Transpose:=True
rng.ClearContents
rng1.End(xlDown).Select
Loop
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
End Sub

See if that is a start.

--
Regards,
Tom Ogilvy




"deemcm" wrote:

Have a long list of entries. Each entry is the same with a name, address,
email etc. all in a column. Then the next entry is two lines down. How can
I copy all the entries and paste them transposing the columns and rows? I'm
sure I'll need a macro of some sort, but I'm rusty on macro making.



All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com