View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy Andy is offline
external usenet poster
 
Posts: 414
Default CurrentRegion in 2007 Sort

I used to add currentregion to a sort macro in 2003 so that as the list
increased, the macro would automatically include the new items. I can't
figure out how to do that in 2007. Below is a sample recorded macro with a
specified range. How do I make it "grow" automatically as the list grows?
Thanks.

Sub Macro2()
ActiveWorkbook.Worksheets("Quarter 1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Quarter 1").Sort.SortFields.Add
Key:=Range("E4"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Quarter 1").Sort
.SetRange Range("A4:G78")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub