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: 21
Default Sorting Question

I am using Excel 2010 and I have some "sort code" that is the result
of the macro recorder. Is there anything that I can use in place of
G2:G109 as the range address? The data can be more or less the next
time that I run the macro and therefore I'd rather not use a hard
coded range. I tried using things like xlDown and few other things
that I found from research but nothing really worked. Thanks very
much.

'sort
ActiveWorkbook.Worksheets("My Calcs").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("My Calcs").Sort.SortFields.Add
Key:=Range( _
"G2:G109"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("My Calcs").Sort
.SetRange Range("A1").CurrentRegion
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
 
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
Sorting Question Jennifer Excel Discussion (Misc queries) 0 April 14th 08 10:11 PM
Re my question on sorting judie Excel Worksheet Functions 1 April 2nd 07 02:06 AM
Sorting question-is this possible JOUIOUI Excel Programming 1 March 6th 07 10:44 PM
Sorting Question srroduin Excel Programming 1 May 30th 06 11:41 PM
Sorting question Erin[_5_] Excel Programming 1 February 16th 04 02:47 AM


All times are GMT +1. The time now is 09:52 PM.

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"