ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting and mapping change (https://www.excelbanter.com/excel-programming/385115-sorting-mapping-change.html)

kirkm[_6_]

Sorting and mapping change
 
Hi,

I'm using this for a sort routine :-

Sub SortCol(strSheetName As String, strColumnLetter As String,
strSortOrder As String)

Dim rngCurrentCell As Range
Dim rngNextCell As Range
Dim strColumnRange

strColumnRange = "A1:M" & mCt
strColumnLetter = strColumnLetter & "1"

If strSortOrder = "D" Then
Worksheets(strSheetName).Range(strColumnRange).Sor t _
Key1:=Worksheets(strSheetName).Range(strColumnLett er),
Order1:=xlDescending
Else
Worksheets(strSheetName).Range(strColumnRange).Sor t _
Key1:=Worksheets(strSheetName).Range(strColumnLett er),
Order1:=xlAscending
End If
Set rngCurrentCell =
Worksheets(strSheetName).Range(strColumnRange)

End Sub

....and all is well. A nice refinement would be to know
where the previously selecteted row was sorted to.
(So I could re-select it).

Apart from searching for it, is there any other way?

Thanks - Kirk


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com