O
ordnance1
How can I make the code below work on any worksheet?
Sub SortByDate()
ActiveWorkbook.Worksheets("DateCheck").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DateCheck").Sort.SortFields..Add Key:=Range( _
"C4:C24"), SortOn"=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DateCheck").Sort
.SetRange Range( "B3:K24" )
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Sub SortByDate()
ActiveWorkbook.Worksheets("DateCheck").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("DateCheck").Sort.SortFields..Add Key:=Range( _
"C4:C24"), SortOn"=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("DateCheck").Sort
.SetRange Range( "B3:K24" )
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub