I've got a macro that opens a text file, formats it, adds headers, and the
sorts the data. Everything works EXCEPT for the sorting. I get this error.
"The sort reference is not valid. Make sure it is within the data you want
to sort, and the first Sort By box isn't the same or blank."
Here is where it hangs up. This was more or less recorded and used as is.
Worksheets(MyWorkSheet).Range("B2").CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Key2:=Range("D2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
TIA,
Paul Hammond
Richmond, Virginia
--
Can't we all just get along?
Bookmarks