D
David127
I created a Macro that works fine but when I try to use the code with a
command button it fails to sort - "The sort reference is not valid. Make sure
that it's within the data you want to sort, and the first Sort box isn't the
same or blank".
Private Sub cmdCopyList_MTN3_Click()
Application.Goto Reference:="List_MTN2"
Selection.Copy
Application.Goto Reference:="List_MTN3"
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Selection.Copy
Application.Goto Reference:="List_MTN2"
End Sub
Thanks for your help!
command button it fails to sort - "The sort reference is not valid. Make sure
that it's within the data you want to sort, and the first Sort box isn't the
same or blank".
Private Sub cmdCopyList_MTN3_Click()
Application.Goto Reference:="List_MTN2"
Selection.Copy
Application.Goto Reference:="List_MTN3"
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Selection.Copy
Application.Goto Reference:="List_MTN2"
End Sub
Thanks for your help!