Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default .Sort.SortFields

with selection
.Cells.Sort key1:=.Columns(1), order1:=xlAscending, _
Header:=xlno, MatchCase:=False, Orientation:=xlTopToBottom
End with


MESTRELLA29 wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default .Sort.SortFields

Excelente!!!!!

Gracias!!!!

HAPPY NEW YEAR ! ! !

"Dave Peterson" wrote:

with selection
.Cells.Sort key1:=.Columns(1), order1:=xlAscending, _
Header:=xlno, MatchCase:=False, Orientation:=xlTopToBottom
End with


MESTRELLA29 wrote:

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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating workbook with an alpha sort sheet and a numeric sort shee cjlatta Excel Discussion (Misc queries) 2 January 28th 09 12:00 AM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
Pls. reply Sort Data and copy to next coulmn when sort order chang shital shah Excel Programming 1 August 19th 05 02:51 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
sort (on part of) string - originally posted under Tricky Sort Tom Ogilvy Excel Programming 0 August 6th 04 02:42 AM


All times are GMT +1. The time now is 12:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"