sort macro not working

Joined
Sep 18, 2012
Messages
1
Reaction score
0
This is to copy from sheet1 then paste to sheet2 then sort the data in descending order with reference to column A. But the problem is that data data in sheet2 is not sorting, nothing is happening


Sheets("Sheet1").Select
Sheets("Sheet1").Range("A:K").Select
Selection.Copy

Sheets("Sheet2").Select
Sheets("Sheet2").Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Sheets("Sheet2").Range("A:K").Select
Selection.AutoFilter
Range("A:K").Sort Key1:=Range("A2"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
 
Works for me. Initially I took out the Selection.AutoFilter line (commented it out) to test but after that was fine.
 
Back
Top