LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Sort Macro

I'm curious to find out if I can eliminate the Range on the below macro I
created?

I want to it to not care what Range I select, as long as the Range includes
cells from column AN (Not the entire column). Since Excel 2007 does not save
the sort parameters I need to figure out a way to automate the sort. I have
several worksheets and several seperate ranges I need to sort on. Is this
possible? I want to run the macro AFTER I select the Range I want to sort
and not have the macro select the Range.

Sub SortByColumAN()
'
' Sorts data by column AN
' Keyboard Shortcut: Ctrl+Shift+Z
'
ActiveWorkbook.Worksheets("Renewal Rate").Sort.SortFields.Add
Key:=Range( _
"AN54:AN58"), SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Renewal Rate").Sort
.SetRange Range("E54:DF58")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
 
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
sort macro Jean-Marie Excel Discussion (Misc queries) 8 February 5th 10 04:29 PM
Macro conversion from Lotus 1-2-3 to Excel (Sort Macro) cgsteel Excel Programming 8 May 3rd 08 12:58 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM
Sort Macro CamEns Excel Programming 3 July 10th 04 06:09 AM


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

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

About Us

"It's about Microsoft Excel"