Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting data

Status
Not open for further replies.

Drej

Mechanical
Joined
Jul 31, 2002
Messages
971
Location
GB
Community,

I have numerical data in Excel in the following column format:

A B C D
E F G H
etc.

where A, B etc = a number

The data is 4 columns (A B C D) x 1251 rows. I would really like to have this data sorted into the format

A
B
C
D
...

Any ideas?

Many thanks.


------------
See faq569-1083 for details on how to make best use of Eng-Tips.com
 
Managed to do it in the end using the code below.

Code:
Sub sort_data()
'
' proper Macro

For j = 1 To 1251 Step 1
    Range(Cells(j, 1), Cells(j, 4)).Select
    Selection.Copy
    Range(Cells((j * 4) + 1, 6), Cells((j * 4) + 1, 6)).Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Next j
End Sub


------------
See faq569-1083 for details on how to make best use of Eng-Tips.com
 
In the Paste Special applet, there is a Transpose check box. I think this would do what you are describing.
 
You could also do the following:
Select your range (A1:D1251)
Copy
Select a new worksheet, cell A1
Right click, PasteSpecial - Transpose (at the bottom of the dialog box)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top