ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I convert rows into columns? (https://www.excelbanter.com/excel-discussion-misc-queries/260394-how-do-i-convert-rows-into-columns.html)

Rick

How do I convert rows into columns?
 
J C's Generator Starter & Alternator Co
1160 Providence Rd
Scranton, PA 18508
570-347-0861


A J's Auto Clinic
1430 Main Ave Ste Rear
Scranton, PA 18508
570-343-7828
AUTO REPAIR

Aamco Transmissions
1230 Keyser Ave
Scranton, PA 18504
570-969-1940
AUTO REPAIR


Victor Delta[_2_]

How do I convert rows into columns?
 
"Rick" wrote in message
...
J C's Generator Starter & Alternator Co
1160 Providence Rd
Scranton, PA 18508
570-347-0861


A J's Auto Clinic
1430 Main Ave Ste Rear
Scranton, PA 18508
570-343-7828
AUTO REPAIR

Aamco Transmissions
1230 Keyser Ave
Scranton, PA 18504
570-969-1940
AUTO REPAIR


Copy the row, click the top cell of the desired column, then edit, paste
special and tick transpose.

V


Dave Peterson

How do I convert rows into columns?
 
Maybe a macro would do it:

Maybe...

Option Explicit
Sub testme()
Dim CurWks As Worksheet
Dim NewWks As Worksheet
Dim DestCell As Range
Dim BigArea As Range
Dim SmallArea As Range

Set CurWks = Worksheets("Sheet1")
Set NewWks = Worksheets.Add
Set DestCell = NewWks.Range("A1")

With CurWks
Set BigArea = Nothing
On Error Resume Next
Set BigArea = .Columns(1).Cells.SpecialCells(xlCellTypeConstants )
On Error GoTo 0

If BigArea Is Nothing Then
MsgBox "No constants in column A"
Exit Sub
End If

For Each SmallArea In BigArea.Areas
SmallArea.Copy
DestCell.PasteSpecial Transpose:=True
Set DestCell = DestCell.Offset(1, 0)
Next SmallArea
End With

End Sub

This will not do what you want if you have any formulas in column A.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Rick wrote:

J C's Generator Starter & Alternator Co
1160 Providence Rd
Scranton, PA 18508
570-347-0861

A J's Auto Clinic
1430 Main Ave Ste Rear
Scranton, PA 18508
570-343-7828
AUTO REPAIR

Aamco Transmissions
1230 Keyser Ave
Scranton, PA 18504
570-969-1940
AUTO REPAIR


--

Dave Peterson


All times are GMT +1. The time now is 08:59 AM.

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