I recorded this macro to do what I need utilizing the macro recorder, it looks as if there is a bunch of un-needed garbage in the macro but I am not adapt enough to clean it up so that the garbage is removed. Can someone here assist me in cleaning up this code so that the garbage is removed from the syntax.
What I am wanting to accomplish with the syntax is:
'Delete Rows 1 and 2
'Copy columns B, E, R, N O, T, V to new worksheet
'Adding in the sort & sub-sort needed
Function Test()
Rows("1:2").Select
Range("N2").Activate
Selection.Delete Shift:=xlUp
Range("N1").Select
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("B:B,E:E,R:R,N:N,O:O,T:T,V:V").Select
Range("V1").Activate
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$1:$G$384").RemoveDuplicates Columns:=2, Header:=xlYes
Columns("E:E").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Columns("C:C").Select
Selection.Cut
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Add Key:=Range("A2:A124") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Add Key:=Range("B2:B124") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet2").Sort
.SetRange Range("A1:H124")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Function
Bookmarks