S
Sandy
I have a simple sort which I have used many times. I recorded it with the
macro recorder and it works fine but when in the code it gets a
'Runtime error 1004'. 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
or blank.
Here is the code.
Sheets("Report Log").Select
Sheets("Report Log").Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("N2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Key3:=Range("B2"),
Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Thanmk you
macro recorder and it works fine but when in the code it gets a
'Runtime error 1004'. 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
or blank.
Here is the code.
Sheets("Report Log").Select
Sheets("Report Log").Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("N2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Key3:=Range("B2"),
Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Thanmk you