J
John Menken
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
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