G
Guest
I have a button macro that opon a worksheet(01-Length of Contract-Rollovers),
selects the sort area(Data), then sort by three criteria(K7, B7, A7). As I
record the macro to do the job it goes smoothly. As soon as I run the
recorded macro or attaches it to a button, it gives me a "Run-time error
'1004'" errorthat states "The sort reference is not valid. Make sure that
it's within the data you want to sort, and the first Sort By box isn't the
same of blank."
Sheets("01-Length of Contract-Rollovers").Select
Application.Goto Reference:="Data"
Selection.Sort Key1:=Range("K7"), Order1:=xlDescending, Key2:=Range("B7") _
, Order2:=xlAscending, Key3:=Range("A7"), Order3:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom _
, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
selects the sort area(Data), then sort by three criteria(K7, B7, A7). As I
record the macro to do the job it goes smoothly. As soon as I run the
recorded macro or attaches it to a button, it gives me a "Run-time error
'1004'" errorthat states "The sort reference is not valid. Make sure that
it's within the data you want to sort, and the first Sort By box isn't the
same of blank."
Sheets("01-Length of Contract-Rollovers").Select
Application.Goto Reference:="Data"
Selection.Sort Key1:=Range("K7"), Order1:=xlDescending, Key2:=Range("B7") _
, Order2:=xlAscending, Key3:=Range("A7"), Order3:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom _
, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal