I have a Macro that selects a range of rows/columns, which will change, daily.
I recorded a second Macro, a Sort Macro, and the stupid thing has a Static Range that is set and won’t match any new selection when run. I was going to put the two Macros together any way. So is there any way to get rid of the Sort Ranges in the Sort Macro and replace them with the new selection that would be generated by the first Macro (GoToEndOfData)??
“First Macro”
Sub GoToEndOfData()
'
' GoToEndOfData Macro
' Goes to End of Data ThenLeft arrow to Last Field
Application.Goto Reference:="EndOfData"
ActiveCell.Offset(0, -1).Select
Range(Cells(17, 1), ActiveCell).Select
End Sub
“Second Macro”
Sub SortNewToOld()
'
' SortNewToOld Macro
'
ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort.SortFields.Add Key:= _
Range("B17:B246"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort
.SetRange Range("A17:H246")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thank You,
Steve
I recorded a second Macro, a Sort Macro, and the stupid thing has a Static Range that is set and won’t match any new selection when run. I was going to put the two Macros together any way. So is there any way to get rid of the Sort Ranges in the Sort Macro and replace them with the new selection that would be generated by the first Macro (GoToEndOfData)??
“First Macro”
Sub GoToEndOfData()
'
' GoToEndOfData Macro
' Goes to End of Data ThenLeft arrow to Last Field
Application.Goto Reference:="EndOfData"
ActiveCell.Offset(0, -1).Select
Range(Cells(17, 1), ActiveCell).Select
End Sub
“Second Macro”
Sub SortNewToOld()
'
' SortNewToOld Macro
'
ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort.SortFields.Add Key:= _
Range("B17:B246"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Entries from 10-6-09").Sort
.SetRange Range("A17:H246")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thank You,
Steve