Hello,
I have a worksheet and have created this VBA to sort a range with two sort keys. First in descending order on Range N8 as the first key ...
... and similarly this routine to sort on Range N8 in ascending order ...
The sorts perform, however, it is not picking up on the second key ... Range R8. Does anyone have a thought on why?
Thanks,
Steve
I have a worksheet and have created this VBA to sort a range with two sort keys. First in descending order on Range N8 as the first key ...
Code:
Sub sort_ruldown()
Application.ScreenUpdating = False
Sort.SortFields.Clear
With Sort
.SortFields.Add Key:=Range("N8"), Order:=xlDescending
.SortFields.Add Key:=Range("R8"), Order:=xlDescending
.SetRange Range("rescomp_table")
.Header = xlYes
.Apply
End With
End Sub
... and similarly this routine to sort on Range N8 in ascending order ...
Code:
Sub sort_rulup()
Application.ScreenUpdating = False
Sort.SortFields.Clear
With Sort
.SortFields.Add Key:=Range("N8"), Order:=xlAscending
.SortFields.Add Key:=Range("R8"), Order:=xlDescending
.SetRange Range("rescomp_table")
.Header = xlYes
.Apply
End With
End Sub
The sorts perform, however, it is not picking up on the second key ... Range R8. Does anyone have a thought on why?
Thanks,
Steve