RE: Sorting a table of data into one column in ascending order
- From: matt3542 <matt3542@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 8 Aug 2008 05:16:01 -0700
Thanks Stefi, much appreciated
"Stefi" wrote:
Assign this macro to a commandbutton:.
Sub testcopy()
first*** = Active***.Name
Sheets.Add
second*** = Active***.Name
Sheets(firstsheet).Select
NoOfRows = Range("A1").End(xlDown).Row
NoOfCols = Range("A1").End(xlToRight).Column
For r = 1 To NoOfRows
Range("A" & r & ":F" & r).Select
Selection.Copy
Sheets(secondsheet).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Range("A" & (r) * NoOfCols + 1).Select
Sheets(firstsheet).Select
Next r
Application.CutCopyMode = False
Sheets(secondsheet).Select
Range("A1:A" & NoOfRows * NoOfCols).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Regards,
Stefi
„matt3542” ezt írta:
Dear Forum,
I am relatively new to VBA and am struggling with the following task and as
such would really appreciate any help;
I have a table of data similar to the example below and I would like to use
a command button to automate the way it is displayed. Ideally I would like
the command button to sort the data in ascending order and display as one
continuous list in column A. Any help gratefully received, thankyou, Matt
col
A B C D E F
10 22 12 23 11 24
9 21 4 14 2 16
7 19 1 15 3 13
5 17 8 18 6 20
- References:
- Prev by Date: Ever wondered how to work with large text imports >256 columns?
- Next by Date: find multiple or by different words
- Previous by thread: RE: Sorting a table of data into one column in ascending order
- Next by thread: Re: OnChange event attached to tick box
- Index(es):