I recorded a simple sort macro
First off it doesn't work and I can't see why - If I manually do a very similar set of key strokes it sorts without a problem but running the macro fails.
Secondly my data starts at A3 (header) and continues for a variable amount of time. there is a chance that there are gaps which is why I have added the additional "Selection.End(xlDown).Select" but I figure there must be a more efficient method of doing this.
Code:
Sub datasort()
' datasort Macro
'Sorts data in the master sheet - Called from main Get Data button
'
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A8").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
End Sub
First off it doesn't work and I can't see why - If I manually do a very similar set of key strokes it sorts without a problem but running the macro fails.
Secondly my data starts at A3 (header) and continues for a variable amount of time. there is a chance that there are gaps which is why I have added the additional "Selection.End(xlDown).Select" but I figure there must be a more efficient method of doing this.