View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MESTRELLA29 MESTRELLA29 is offline
external usenet poster
 
Posts: 26
Default .Sort.SortFields

Problem... I am downoading mi data to excel, after that I have this macro
that sorts the information by coulum A, but it is only sorting .SetRange
Range("A11:N95"), this is ther range when i created the macro, how do I sort
the selected range insted of the Raneg Set by the recorded macro.


Range("A11").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveWorkbook.Worksheets("Recovered_Sheet1").Sort .SortFields.Clear
ActiveWorkbook.Worksheets("Recovered_Sheet1").Sort .SortFields.Add
Key:=Range( _
"A11"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Recovered_Sheet1").Sort
.SetRange Range("A11:N95")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply