View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Glynn Greg Glynn is offline
external usenet poster
 
Posts: 137
Default Need Help with a sort

Can anyone see why this code produces an error?

Windows(ImportFileName).Activate
ActiveWorkbook.ActiveSheet.Cells.Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending,
Key2:=Range("C1") _
, Order2:=xlAscending, Key3:=Range("D1"), Order3:=xlAscending,
Header:=xlNo, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom


The error is:
Run-time Error 1004:
The Sort reference is not valid.

... it's driving me batty.

Thanks in advance.