Sub test45()
ActiveWorkbook.Worksheets("Mog").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Mog").Sort.SortFields.Add Key:=Range("A333:A337") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Mog").Sort
.SetRange Range("A333:X337")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I want to be able to highlight a few rows, then use the macro to sort them by column A. It seems like half this gibberish is unnecessary. I know I can discard the activeworkbook and worksheet specific stuff, but how else can I make this cleaner?
Bookmarks